Update Pateint get dengan format ISO 8601

This commit is contained in:
mikael-zakaria 2025-10-06 13:23:18 +07:00
parent 5c5d56b473
commit a69a5719ad

View File

@ -283,7 +283,7 @@ class PatientModel extends Model {
// $patient["Birthdate"] = $this->formatedDate($patient["Birthdate"]);
// $patient["CreateDate"] = $this->formatedDate($patient["CreateDate"]);
// $patient["DelDate"] = $this->formatedDate($patient["DelDate"]);
// $patient["DeathDateTime"] = $this->formatedDate($patient["DeathDateTime"]);
$patient["DeathDateTime"] = $this->formatedDate($patient["DeathDateTime"]);
$patient["BirthdateConversion"] = $this->formatedDateForDisplay($patient["Birthdate"]);
$patient["LinkTo"] = $this->getLinkedPatients($patient['LinkTo']);
$patient["Custodian"] = $this->getCustodian($patient['Custodian']);
@ -343,20 +343,14 @@ class PatientModel extends Model {
return $formattedAge;
}
// Conversion Time to Format Y-m-d H:i
// private function formatedDate($dateString) {
// $date = \DateTime::createFromFormat('Y-m-d H:i', $dateString);
// Conversion Time to Format Y-m-d\TH:i:s\Z
private function formatedDate($dateString) {
// return $date->format('Y-m-d H:i');
$dt = new \DateTime($dateString, new \DateTimeZone("UTC"));
// if (!$date) {
// $timestamp = strtotime($dateString);
// if ($timestamp) {
// return date('Y-m-d H:i', $timestamp);
// }
// return null;
// }
// return $date->format('Y-m-d H:i');
// }
// Format jadi ISO 8601 dengan 'Z'
return $dt->format('Y-m-d\TH:i:s\Z');
}
// Conversion Time to Format j M Y
private function formatedDateForDisplay($dateString) {