File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change 25
25
use MongoDB \BSON \UTCDateTime ;
26
26
use MongoDB \Laravel \Query \Builder as QueryBuilder ;
27
27
28
- use function abs ;
29
28
use function array_key_exists ;
30
29
use function array_keys ;
31
30
use function array_merge ;
41
40
use function is_string ;
42
41
use function ltrim ;
43
42
use function method_exists ;
44
- use function sprintf ;
45
43
use function str_contains ;
46
44
use function str_starts_with ;
47
45
use function strcmp ;
@@ -139,15 +137,9 @@ public function fromDateTime($value)
139
137
/** @inheritdoc */
140
138
protected function asDateTime ($ value )
141
139
{
142
- // Convert UTCDateTime instances.
140
+ // Convert UTCDateTime instances to Carbon .
143
141
if ($ value instanceof UTCDateTime) {
144
- $ date = $ value ->toDateTime ();
145
-
146
- $ seconds = $ date ->format ('U ' );
147
- $ milliseconds = abs ((int ) $ date ->format ('v ' ));
148
- $ timestampMs = sprintf ('%d%03d ' , $ seconds , $ milliseconds );
149
-
150
- return Date::createFromTimestampMs ($ timestampMs );
142
+ return Date::instance ($ value ->toDateTime ());
151
143
}
152
144
153
145
return parent ::asDateTime ($ value );
You can’t perform that action at this time.
0 commit comments