From 12ef4c167f0df7479eeae9a77cf85cdcca774a8f Mon Sep 17 00:00:00 2001 From: Tb Fajri Date: Tue, 16 Jan 2024 16:48:57 +0700 Subject: [PATCH] validasi tanggal --- Modules/Internal/Services/RequestLogService.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Modules/Internal/Services/RequestLogService.php b/Modules/Internal/Services/RequestLogService.php index 2b5582ff..f2d896c0 100644 --- a/Modules/Internal/Services/RequestLogService.php +++ b/Modules/Internal/Services/RequestLogService.php @@ -106,7 +106,11 @@ class RequestLogService if ($date_from_row instanceof DateTime) { return $date_from_row->format('Y-m-d'); } else if ($date_from_row != null) { - return date('Y-m-d', strtotime($date_from_row)); + if (strtotime($date_from_row)){ + return date('Y-m-d', strtotime($date_from_row)); + } else { + return null; + } } else { return null; } @@ -138,6 +142,12 @@ class RequestLogService 'member_id' => $row['member_id'], ]), 0, null, $row); } + + $dateSubmission = $this->dateParser($row['submission_date']); + if (!$dateSubmission){ + throw new ImportRowException(__('Format Date Invalid'), 0, null, $row); + } + // Membuat singkatan dari nama rumah sakit $singkatan = ""; $words = explode(' ', $row['organization_id']);