-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong format date when created #310
Comments
This doesn't seem to be an issue with the package. |
MySQL field type is class AuditingListener
{
public function handle(Auditing $event)
{
dump($event->model->date); //already wrong value 2017-01-10 00:00:00
}
}
Order::create([
'date' => Request::input('date'); //2017-01-10
]); After this, |
That's an Eloquent issue, which has been documented in the troubleshooting section. |
Can we solve this problem automatically at core level? if (isset($this->casts[$key]) && $this->casts[$key] == 'date') {
return Carbon::parse($value)->toDateString();
} |
Now have to use many crutches before save audit, for example: if (isset($this->casts[$key]) && $this->casts[$key] == 'date') {
return $value->toDateString();
} And before output, for example: if ($value instanceof \DateTime && $value->toTimeString() == '00:00:00') {
return $value->toDateString();
} |
Sorry, I'm not gonna fix upstream issues here. If they say it's an expected behaviour, we should keep it consistent. Bump the upstream issue and propose a fix there, not here. |
Ok ) Thank you for your responsiveness ) |
Actual Behaviour
Saving date field with format
Y-m-d 00:00:00
Expected Behaviour
Saving date field with format
Y-m-d
Steps to Reproduce
Create any record, having date field.
The text was updated successfully, but these errors were encountered: