laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

Consider custom date casts as dateCastable attributes #2564

Closed zupolgec closed 3 years ago

zupolgec commented 3 years ago

On a model I have a couple of date:format custom casts. I just found out that these aren't considered dateCastable fields and as such are calculated as dirty even if the value didn't change.

Would it make sense to add a check with function isCustomDateTimeCast here ⬇️

https://github.com/laravel/framework/blob/c61c8624b988595e24beafd418ef84447893709e/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L1158-L1161

driesvints commented 3 years ago

Heya, thanks for submitting this.

This seems like a feature request or an improvement so I'm moving this to the ideas repository instead. It's best to post these in the ideas repository in the future to get support for your idea. After that you may send a PR to the framework. Please only use the laravel/framework issue tracker to report bugs and issues with the framework.

Thanks!

zupolgec commented 3 years ago

@driesvints I wasn't sure about that. It can be seen as a bug: an attribute with cast date:Y-m-d should be recognised properly as a date by isDateCastable, isn't it?

zupolgec commented 3 years ago

Also I'm not getting why this issue has been closed 🧐