Skip to content

Commit 9f12bc1

Browse files
committed
feat: update with new fn mode API
1 parent ba85333 commit 9f12bc1

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/functions.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ function tick(string $userDate = null, string $userTimeZone = null)
1414
return (new Leaf\Date())->tick($userDate, $userTimeZone);
1515
}
1616

17-
$date = Leaf\Config::get('date')['instance'] ?? null;
18-
19-
if (!$date) {
20-
$date = new Leaf\Date();
21-
Leaf\Config::set('date', ['instance' => $date]);
17+
if (!(\Leaf\Config::getStatic('date'))) {
18+
\Leaf\Config::singleton('date', function () {
19+
return new \Leaf\Date();
20+
});
2221
}
2322

23+
$date = \Leaf\Config::get('date');
24+
2425
if ($userDate) {
2526
$date->tick($userDate, $userTimeZone);
2627
}

0 commit comments

Comments
 (0)