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