Skip to content
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

[8.x] - fix for custom date castable and database value formatting #38994

Conversation

macbookandrew
Copy link
Contributor

@macbookandrew macbookandrew commented Sep 27, 2021

This is a followup to #38720 and #38828.

Instead of always treating custom_datetime and immutable_custom_datetime casts as isDateCastable(), this only checks them in the originalIsEquivalent() method.

This retains the old behavior for formatting values for the database, while incorporating a fix to ensure that custom (immutable) date casts are compared correctly, even if the Carbon instance is not identical.

@taylorotwell taylorotwell merged commit 4b6b977 into laravel:8.x Sep 28, 2021
victorvilella pushed a commit to cdsistemas/framework that referenced this pull request Oct 12, 2021
…aravel#38994)

* add tests

See laravel#38828 and laravel#38720

* update test to pass against current framework

* use correct carbon instance types

* add custom datetime back to isDateCastable

See #388828, laravel#38720

* use underlying Carbon

* assign strings instead of Carbon instances

* check for custom datetime format only when comparing equivalence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants