Upgrade to 3.7.0

This commit is contained in:
Bastian Allgeier
2022-06-27 10:02:22 +02:00
parent 0751a6510d
commit 1c22148d7b
674 changed files with 5052 additions and 3082 deletions

26
kirby/src/Toolkit/Date.php Normal file → Executable file
View File

@@ -359,6 +359,32 @@ class Date extends DateTime
return $this;
}
/**
* Rounds the minutes of the given date
* by the defined step
* @since 3.7.0
*
* @param string|null $date
* @param int|array|null $step array of `unit` and `size` to round to nearest
* @return int|null
*/
public static function roundedTimestamp(?string $date = null, $step = null): ?int
{
if ($date = static::optional($date)) {
if ($step !== null) {
$step = static::stepConfig($step, [
'unit' => 'minute',
'size' => 1
]);
$date->round($step['unit'], $step['size']);
}
return $date->timestamp();
}
return null;
}
/**
* Gets or sets the second value
*