Skip to content

Commit 4dc1711

Browse files
committed
feat: use $db->dateFormat in Model
1 parent 3b23657 commit 4dc1711

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

system/BaseModel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,10 +1356,10 @@ protected function intToDate(int $value)
13561356
return $value;
13571357

13581358
case 'datetime':
1359-
return date('Y-m-d H:i:s', $value);
1359+
return date($this->db->dateFormat['datetime'], $value);
13601360

13611361
case 'date':
1362-
return date('Y-m-d', $value);
1362+
return date($this->db->dateFormat['date'], $value);
13631363

13641364
default:
13651365
throw ModelException::forNoDateFormat(static::class);
@@ -1382,10 +1382,10 @@ protected function timeToDate(Time $value)
13821382
{
13831383
switch ($this->dateFormat) {
13841384
case 'datetime':
1385-
return $value->format('Y-m-d H:i:s');
1385+
return $value->format($this->db->dateFormat['datetime']);
13861386

13871387
case 'date':
1388-
return $value->format('Y-m-d');
1388+
return $value->format($this->db->dateFormat['date']);
13891389

13901390
case 'int':
13911391
return $value->getTimestamp();

0 commit comments

Comments
 (0)