Regarding dates ... #799
Replies: 4 comments 7 replies
-
Basically, we currently takes "whatever eloquent casts to us". Im saying we should consider taking what is in the table instead. |
Beta Was this translation helpful? Give feedback.
-
Hi, @erikn69 @parallels999 any thoughts? And can you send me your discord username? Then I can invite you to private channels. |
Beta Was this translation helpful? Give feedback.
-
What about backwards compatibility? |
Beta Was this translation helpful? Give feedback.
-
Alright. I stabbed at dates, casts and serialization, but i'm having a hard time finding and proving actual issues. It's more or less "just output logic" 🤷 Im dropping the serialization refactor all together 😄 |
Beta Was this translation helpful? Give feedback.
-
Hi all! (@erikn69 , @anteriovieira @parallels999 etc)
I am preparing a v14 branch, and in that process i am considering different scenarios that has been handled "here and there". One of those are how we handle datetime.
I am torn between letting the package itself lean on the principle of "simple storage of whatever is currently written", or "recording what is in the table".
The difference i subtle, but with regards to dates, the timezone on save is a piece of information we are ignoring when we save the datetime string as we are used to seeing it in MySQL.
Most database engines will keep a datetime column in some sort of format that you unpack on retrieval. As PHP and laravel developers we may be used to seeing the "Y-m-d H:i:s" format, but if we lean on this in the package, we may be limiting a bit too much, as this is not literally the information we have.
Laravels own json serializer formats according to the ISO-8601 standard (as proposed here: laravel/ideas#1940) - and thus basically doing what carbon does
My suggestion would be to change behaviour to lean on the ISO-8601 approach when serializing dates to json.
Pros or cons?
Beta Was this translation helpful? Give feedback.
All reactions