Recently migrated my app to Cake 5 - I’ve run into issues in my existing code when comparing two dates, where suddenly the result is always false. For example $date1 < $date2.
After some digging it seems like that cause of this new behaviour is I am comparing Cake\I18N\Date objects with Cake\I18N\DateTime objects. Previously I believe I was using FrozenDate\FrozenTime and the migrations script automatically replaced them.
In the cake5 documentation it says that Date objects have a fixed time of 00:00:00 - so one would think that you could compare these two objects simply?
I was wondering if I others are able to replicate this behaviour and, if so, is it the correct/desired behaviour in CakePHP 5? Perhaps I should avoid using comparison operators altogether and instead use the objects comparison methods?
The reason why this this is not working anymore since CakePHP 5 (and more specifically since Chronos 3) is the fact, that Date objects and DateTime Objects don’t share the same DateTimeImmutable class anymore.