Hey Am 03.03.21 um 13:05 schrieb Hans Henrik Bergan: > if FWIW if DateTime::__toString() was just > function __toString():string{ > return $this->format(\DateTime::RFC3339); > } > > i certainly wouldn't complain. > > On Wed, 3 Mar 2021 at 12:16, Bruce Weirdan <weir...@gmail.com> wrote: > >> On Wed, Mar 3, 2021 at 1:07 PM Moritz Friedrich <m...@9dev.de> wrote: >> >>> but I’m not too fond of the constant - all other built-in date constants >>> translate to a string of plain format characters, which isn’t possible in >>> this case >> >> >> Adding another format character (similar to %c used by >> DateTimeInterface::format()) would solve that.
I'd rather see those classes as ValueObjects that should not have to take care about their external representation. And a custom Formatter that handles all the weird edge cases as a separate entity would be a much easier to maintain approach. And such a Formatter can easily be build in userland (I think I wrote one myself at one point) and so the maintenance-burden would also not be added to internals. That would also apply to the DateTimeInterval::format() method but that would mean a massive BC break so it is most likely out of the question. Nevertheless I would prefer an external library to handle all those formatting issues and treat the DateTime lib as internal ValueObjects Cheers Andreas -- ,,, (o o) +---------------------------------------------------------ooO-(_)-Ooo-+ | Andreas Heigl | | mailto:andr...@heigl.org N 50°22'59.5" E 08°23'58" | | https://andreas.heigl.org | +---------------------------------------------------------------------+ | https://hei.gl/appointmentwithandreas | +---------------------------------------------------------------------+
OpenPGP_signature
Description: OpenPGP digital signature