mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Adjust rng datetime
This commit is contained in:
parent
043b0c70fe
commit
df6c8dc48f
|
|
@ -82,7 +82,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
$list = [];
|
||||
|
||||
foreach (glob($path . DIRECTORY_SEPARATOR . $filter) as $filename) {
|
||||
$list[] = $filename;
|
||||
$list[] = str_replace(['/\\', '\\'], ['/', '/'], $filename);
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
|
|
|||
|
|
@ -28,20 +28,17 @@ class DateTime
|
|||
{
|
||||
|
||||
/**
|
||||
* Get a random string.
|
||||
* Get a random \DateTime.
|
||||
*
|
||||
* @param string $start Start date
|
||||
* @param string $end End date
|
||||
* @param \DateTime $start Start date
|
||||
* @param \DateTime $end End date
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function generateDateTime(string $start, string $end) : \DateTime
|
||||
public static function generateDateTime(\DateTime $start, \DateTime $end) : \DateTime
|
||||
{
|
||||
$startDate = strtotime($start);
|
||||
$endDate = strtotime($end);
|
||||
|
||||
return new \DateTime(date('Y-m-d H:i:s', mt_rand($startDate, $endDate)));
|
||||
return new \DateTime(date('Y-m-d H:i:s', mt_rand($startDate->getTimestamp(), $endDate->getTimestamp())));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user