From b0e5cd010f3219f3707d8c544aa8955d060277ae Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Sun, 15 Jan 2023 21:05:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E7=94=9F=E6=97=A5?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/User.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index 47e8090..33a9b43 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -110,9 +110,11 @@ private function getBirthdayFromIdCard(): string { $idCard = $this->id_card; - $year = substr($idCard, 6, 4); - $month = substr($idCard, 10, 2); - $day = substr($idCard, 12, 2); + $bir = substr($idCard, 6, 8); + $year = (int) substr($bir, 0, 4); + $month = (int) substr($bir, 4, 2); + $day = (int) substr($bir, 6, 2); + return $year . '-' . $month . '-' . $day; }