Hi Am 2026-06-18 18:33, schrieb Jorg Sowa:
So what kind of format this method will except, standard ISO, or PHP's version of ISO? Maybe it's worth to find another name?
The method will accept a ISO-8601 “Period” string, just like `DateInterval::__construct()` does. The only restriction is that period strings accepted by the Time\Duration class may only contain the “time” components. In simplified terms: The given string must start with `PT`.
The format strings you are thinking about are those to format date-times, which is a different concern and which will become relevant when classes to represent dates and times are added in the future. Given those are intended to fix the issues of the current API, I expect them to exactly follow the relevant standards when referring to a standard. Just like the URI parsers in the new URI extension follow the WHATWG and RFC 3986 standards - and any difference is considered a bug. Given that namespaces for PHP’s standard library are a relatively new thing, this luckily allows us to fix issues by building an entirely new, well-designed API without breaking backwards compatibility and without needing to come up with weird names to avoid conflicts. This worked well for the new random API in 8.2, the new DOM API in 8.4 and the new URI API in 8.5 and we hope to continue that with the new date API starting in 8.6.
Best regards Tim Düsterhus
