File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ public function getQualifiedKeyName()
106
106
*
107
107
* @param mixed $value
108
108
*/
109
- public function fromDateTime ($ value ): UTCDateTime
109
+ public function fromDateTime ($ value ): UTCDateTime | string
110
110
{
111
111
// If the value is already a UTCDateTime instance, we don't need to parse it.
112
112
if ($ value instanceof UTCDateTime) {
@@ -117,7 +117,9 @@ public function fromDateTime($value): UTCDateTime
117
117
if (! $ value instanceof DateTimeInterface) {
118
118
$ value = parent ::asDateTime ($ value );
119
119
}
120
-
120
+ if (isset ($ this ->dateFormat )) {
121
+ return $ value ->format ($ this ->getDateFormat ());
122
+ }
121
123
return new UTCDateTime ($ value );
122
124
}
123
125
@@ -148,9 +150,6 @@ public function getDateFormat()
148
150
/** @inheritdoc */
149
151
public function freshTimestamp ()
150
152
{
151
- if (isset ($ this ->dateFormat )) {
152
- return Date::now ();
153
- }
154
153
return new UTCDateTime (Date::now ());
155
154
}
156
155
You can’t perform that action at this time.
0 commit comments