File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55if (!function_exists ('tick ' )) {
66 /**
7- * Return the leaf date instance
8- * @return Leaf\Date
7+ * Initialize a new date instance
8+ * @param string|DateTime $userDate The date to initialize with
9+ * @param string|null $userTimeZone The timezone to initialize with
10+ * @return \Leaf\Date
911 */
10- function tick (? string $ userDate = null , ?string $ userTimeZone = null )
12+ function tick ($ userDate = ' now ' , ?string $ userTimeZone = null ): \ Leaf \ Date
1113 {
12- if (!class_exists ('Leaf\App ' )) {
13- return (new Leaf \Date ())->tick ($ userDate , $ userTimeZone );
14- }
15-
16- if (!(\Leaf \Config::getStatic ('date ' ))) {
17- \Leaf \Config::singleton ('date ' , function () {
18- return new \Leaf \Date ();
19- });
20- }
21-
22- $ date = \Leaf \Config::get ('date ' );
23-
24- if ($ userDate ) {
25- $ date ->tick ($ userDate , $ userTimeZone );
26- }
27-
28- return $ date ;
14+ return (new Leaf \Date ())->tick ($ userDate , $ userTimeZone );
2915 }
3016}
You can’t perform that action at this time.
0 commit comments