-
Notifications
You must be signed in to change notification settings - Fork 91
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
Laravel 10 future support. #89
Comments
In all honesty I’ve no idea. If you’re looking at this can you test it and let me know? I suspect the ideal solution would be to add a custom cast to the package. |
Hi. We have tested and it doesnt work anymore. $dates property used to work fine but has since been deprecated. Thanks!
we are testing 'valid_until' => 'datetime:Y-m-d H:i:s', |
This works:
This used to work when i declared a date with $dates property:
|
IMHO this does not break anything. Just make sure that the first parameter passed to I have something like this: protected $casts = [
'created_at' => 'datetime:Y-m-d H:i:s',
]; and |
@boryn try a custom datetime column from mysql and try to cast it the same way. It doesn't convert |
I tried with: protected $casts = [
'start_date' => 'datetime:Y-m-d H:i:s',
'stop_date' => 'datetime:Y-m-d H:i:s',
]; where start date is defined as simple date in MySQL: and I get: Illuminate\Support\Carbon Object
(
[endOfTime:protected] =>
[startOfTime:protected] =>
[constructedObjectId:protected] => 0000000000000ab40000000000000000
[localMonthsOverflow:protected] =>
[localYearsOverflow:protected] =>
[localStrictModeEnabled:protected] =>
[localHumanDiffOptions:protected] =>
[localToStringFormat:protected] =>
[localSerializer:protected] =>
[localMacros:protected] =>
[localGenericMacros:protected] =>
[localFormatFunction:protected] =>
[localTranslator:protected] =>
[dumpProperties:protected] => Array
(
[0] => date
[1] => timezone_type
[2] => timezone
)
[dumpLocale:protected] =>
[dumpDateProperties:protected] =>
[date] => 2023-03-05 00:00:00.000000
[timezone_type] => 3
[timezone] => America/New_York
) so it seems to be working. Maybe you have somewhere some additional accessor that modifies the value, maybe Actually what error do you get after running directly: Have you tried running statically |
@boryn serializeDate doesn't pick up custom dates is the issue. https://laravel.com/docs/10.x/eloquent-serialization#customizing-the-default-date-format |
What do you mean by "doesn't pick up custom dates"? The serialization date format like 'Y-m-d H:i:s' is only applied when you use |
@boryn yes. It does now but that's not how views are rendered. This plug-in used to work with laravel 9 just fine declaring custom dates with dates property. I have the serializeDate in a baseModel and used to convert the readable dates to the useds timezone on the fly. Now I need to exclude the formatting of the date to have it work. |
Hi James
Right now if a new data is declared with protected $dates it gets converted with base timezone helper.
The new docs have changed this:
`Model "Dates" Property
Likelihood Of Impact: Medium
The Eloquent model's deprecated $dates property has been removed. Your application should now use the $casts property:
protected $casts = [
'deployed_at' => 'datetime',
];`
Will it still work as intended?
Thanks
The text was updated successfully, but these errors were encountered: