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

Conversion of Duration and Period uses ISO-8601, but other temporal accessors are converted using the current locale #21521

Closed
wilkinsona opened this issue May 20, 2020 · 3 comments
Assignees
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@wilkinsona
Copy link
Member

wilkinsona commented May 20, 2020

Raised by @wimdeblauwe on Gitter, if you use LocalTime in a @ConfigurationProperties class it is converted using the system locale, whereas conversion to Duration and Period is always done using ISO-8601. We document the behaviour for Duration and Period. This created an expectation that LocalTime and the like would be treated in the same way. The inconsistency of them being treated differently was then unexpected.

@wilkinsona wilkinsona added for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels May 20, 2020
@wimdeblauwe
Copy link
Contributor

This is the relevant SO question about it that contains the configuration that is needed to make it work as I would expect: https://stackoverflow.com/q/61911328/40064

@philwebb philwebb added type: enhancement A general enhancement and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels May 29, 2020
@philwebb philwebb added this to the 2.x milestone May 29, 2020
@philwebb philwebb modified the milestones: 2.x, 3.0.x May 4, 2022
@philwebb philwebb modified the milestones: 3.0.x, 3.1.x Oct 17, 2022
@wilkinsona
Copy link
Member Author

wilkinsona commented Oct 18, 2022

We should check if the current behaviour has changed due to the changes in Framework for spring-projects/spring-framework#26985.

@philwebb philwebb modified the milestones: 3.1.x, 3.0.x Oct 18, 2022
@wilkinsona
Copy link
Member Author

The changes in spring-projects/spring-framework#26985 have fixed this. When the current locale causes the parsing to fail, Framework now falls back to ISO-8601-based parsing. This means that an input like 06:00 can always be converted to a LocalTime irrespective of the locale. This applies to all TemporalAccessor types.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2022
@wilkinsona wilkinsona removed this from the 3.0.x milestone Oct 19, 2022
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue for: external-project For an external project and not something we can fix labels Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants