Hi

On 2026-09-23 21:57, Théo Attali wrote:
If I may add one small suggestion: could toIso8601DateTimeString() be shortened to toIso8601String() and fromIso8601DateTimeString() to fromIso8601String() ?

Since Time\Instant already represents a date-time value, these shorter names remain clear and are easier to use.

The proposed wording is consistent with `Time\Duration::fromIso8601DurationString()` which also includes the explicit “Duration” indicator. It also has some practical benefits: ISO-8601 defines a multitude of interchange formats that could be reasonably interpreted as being applicable, particularly with some components being implied as accepted by DateTimeImmutable. As an example `Instant::fromIso8601String('2026-09-25')` could be argued to mean “midnight UTC on 2026-09-25”.

I believe the naming strikes an appropriate middle-ground between specific, while not being overly verbose and it leaves some future space for a `toIso8601OrdinalDateTimeString()` to emit `2026-268T13:55:00Z` (with 268 referring to the 268th day of the year 2026), with the 2026-09-25 being the “calendar date” format, where the “calendar” part is being implied (and also the “extended” representation being implied).

Best regards
Tim Düsterhus

Reply via email to