Closed intarga closed 6 months ago
Hey, thanks for this and sorry it's taken so long to get back to you.
Serialisation / deserialisation for durations has come up a couple of times. My main argument for not including it is that chrono doesn't include anything for their own durations, but also it's not a great standard for durations. However I'm willing to include it if we can get a "good enough" implementation.
There are a few thorny issues to solve - namely:
P0,5Y
is valid iso8601, but we don't allow fractions of years or months due to ambiguity)relativeduration -> iso
representation - should we map 13 months to P1Y1M
or P13M
? should this be configurable?No worries! And thanks for getting back to me.
P1Y1M
.I'll also add a fourth thorny issue:
P5W
)? For deserialisation, I think it should be ok to just times by 7 and add this as days the the chrono duration. For serialisation I don't think we should use weeks at all.P13M
etc.Ok, it seems like we have a clear path forward. I’m a little busy right now, but I’ll refine my implementation and file a PR when i have time
Thanks! No rush :)
So, I wrote an ISO 8601 subset parser for my own purposes, and I was wondering it it's a wanted feature? Personally I've ended up needing it everywhere I use chronoutil.
Currently it doesn't support decimals or weeks, because I didn't need either, but I could add those and submit a PR if it's wanted.