spatie / period

Complex period comparisons
https://spatie.be/open-source
MIT License
1.55k stars 72 forks source link

ISO-8601 time interval support #108

Closed Wizofgoz closed 2 years ago

Wizofgoz commented 2 years ago

It'd be nice to be able to translate to/from the ISO-8601 time interval standard.

I'm surprised how little support there is in PHP for this as it's a nice, concise way of expressing a period of time. thephpleague's package has partial support but doesn't allow for using durations in the start (P1M/2022-02-01T00:00:00Z) or end (2022-01-01T00:00:00Z/P1M) nor for using a condensed datetime for the end such as 2022-01-01T00:00:00Z/15 which expands to 2022-01-01T00:00:00Z/2022-01-15T00:00:00Z.

The standard doesn't allow for transferring bounds but they could be defined in a parameter.