Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support negative period prefix in Calendar.ISO.parse_duration/1 #13608

Merged

Conversation

tfiedlerdejanze
Copy link
Contributor

Negative durations are actually specified in ISO 8601-2 while individual negative units are not. The Java Duration class supports both features and i think the negative duration prefix may actually be more common than the one for individual units. IMHO it makes sense that we also support both in the standard library.

@tfiedlerdejanze tfiedlerdejanze changed the title Support negative period prefix in Calendar.ISO.parse_duration/1 Support negative period prefix in Calendar.ISO.parse_duration/1 May 27, 2024
@josevalim josevalim merged commit 420a939 into elixir-lang:main May 27, 2024
9 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@tfiedlerdejanze
Copy link
Contributor Author

@josevalim given the links i posted in the PR description, would you be open to also allowing +P10D? I don't really see a practical need for it, but would add it since it's specified in ISO 8601-2. With that, i think we'd cover everything we want for the extended specification, except for the fact that we intentionally allow decimal fractions only for seconds

@josevalim
Copy link
Member

Yes, we should definitely support the plus version too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants