[php-src] Issue #15679: Why PHP does not have a Date class?
| From: | javaDeveloperKid | Date: | Sat, 31 Aug 2024 13:16:07 +0000 |
| Subject: | [php-src] Issue #15679: Why PHP does not have a Date class? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247659@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15679
Author: javaDeveloperKid
### Description
Some of my properties represent a Date (2024-08-31), not a Date and Time (2024-08-31 15:10:00).
Right now I have to use DateTimeImmutable type hint what gives wrong information about what a
property represents.
I wonder why PHP still doesn't have Date class in 2024. Isn't is as simple as removing
time information and time related methods from DateTime class? Date and DateTime instances would be
comparable (==, >, < etc.) and during the comparison the time for Date instance would be
implicitly 00:00:00.
P.S. Ofc Date class should be immutable so PHP doesn't end up with Date and DateImmutable
:smile:
Best