Update Kirby and Composer dependencies
This commit is contained in:
parent
f5d3ea5e84
commit
ec74d78ba9
382 changed files with 25077 additions and 4955 deletions
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Toolkit\Date;
|
||||
|
||||
return [
|
||||
'props' => [
|
||||
/**
|
||||
|
@ -11,16 +13,21 @@ return [
|
|||
],
|
||||
'methods' => [
|
||||
'toDatetime' => function ($value, string $format = 'Y-m-d H:i:s') {
|
||||
if ($timestamp = timestamp($value, $this->step)) {
|
||||
return date($format, $timestamp);
|
||||
if ($date = Date::optional($value)) {
|
||||
if ($this->step) {
|
||||
$step = Date::stepConfig($this->step);
|
||||
$date->round($step['unit'], $step['size']);
|
||||
}
|
||||
|
||||
return $date->format($format);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
],
|
||||
'save' => function ($value) {
|
||||
if ($value !== null && $timestamp = strtotime($value)) {
|
||||
return date($this->format, $timestamp);
|
||||
if ($date = Date::optional($value)) {
|
||||
return $date->format($this->format);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue