You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing an issue when the value of a date is null instead of being a date. I understand that value 'null' should not be stored as date in mongodb but it happens.
As a workaround I have implemented this small change in Eloquent/Model.php (l.98)
/**
* @inheritdoc
*/
protected function asDateTime($value)
{
// Convert UTCDateTime instances.
if ($value instanceof UTCDateTime) {
return Carbon::createFromTimestamp($value->toDateTime()->getTimestamp());
}
if (isset($value)){
return parent::asDateTime($value);
}
return '';
}
Is there a better way to address this issue?
The text was updated successfully, but these errors were encountered:
Hello -
I'm facing an issue when the value of a date is
null
instead of being a date. I understand that value 'null' should not be stored as date in mongodb but it happens.As a workaround I have implemented this small change in Eloquent/Model.php (l.98)
Is there a better way to address this issue?
The text was updated successfully, but these errors were encountered: