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

Add utility to parse Duration from a String #22474

Closed
mp911de opened this issue Feb 26, 2019 · 3 comments
Closed

Add utility to parse Duration from a String #22474

mp911de opened this issue Feb 26, 2019 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@mp911de
Copy link
Member

mp911de commented Feb 26, 2019

It would make sense to have a common utility to parse java.time.Duration from a CharSequence.

Examples:

  • 10ms -> 10 milliseconds
  • 10s -> 10 seconds
  • 10m -> 10 minutes
  • 10h -> 10 hours

ChronoUnits to support:

  • Nanos
  • Micros
  • Millis
  • Seconds
  • Minutes
  • Hours
  • Days

Spring Boot provides this functionality and we'd like to reuse it in Spring Data.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 26, 2019
@jhoeller jhoeller self-assigned this Feb 28, 2019
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Mar 5, 2019
@ilyavy
Copy link

ilyavy commented Jan 21, 2020

Relates to #22013

@rstoyanchev
Copy link
Contributor

rstoyanchev commented Aug 2, 2022

Team Decision: We can do this in fallback mode, trying the built-in Duration formatting, and then falling back on alternative formats, in effect extending the built-in one. We should ensure the spec of what Boot supports already, works in the new arrangement.

@simonbasle
Copy link
Contributor

linked to #22013 and superseded by gh-30396

@simonbasle simonbasle closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2023
@jhoeller jhoeller removed this from the 6.1.x milestone May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

9 participants