-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
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
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged or decided on
label
Feb 26, 2019
sbrannen
added
the
in: core
Issues in core modules (aop, beans, core, context, expression)
label
Mar 5, 2019
Relates to #22013 |
Closed
4 tasks
Team Decision: We can do this in fallback mode, trying the built-in |
rstoyanchev
added
type: enhancement
A general enhancement
and removed
for: team-attention
status: waiting-for-triage
An issue we've not yet triaged or decided on
labels
Aug 2, 2022
simonbasle
added
the
status: superseded
An issue that has been superseded by another
label
May 16, 2023
bclozel
pushed a commit
that referenced
this issue
Jul 23, 2024
This commit introduces a notion of different styles for the formatting of Duration. The `@DurationFormat` annotation is added to ease selection of a style, which are represented as DurationFormat.Style enum, as well as a supported time unit represented as DurationFormat.Unit enum. DurationFormatter has been retroffited to take such a Style, optionally, at construction. The default is still the JDK style a.k.a. ISO-8601. This introduces the new SIMPLE style which uses a single number + a short human-readable suffix. For instance "-3ms" or "2h". This has the same semantics as the DurationStyle in Spring Boot and is intended as a replacement for that feature, providing access to the feature to projects that only depend on Spring Framework. Finally, the `@Scheduled` annotation is improved by adding detection of the style and parsing for the String versions of initial delay, fixed delay and fixed rate. See gh-22013 See gh-22474 Closes gh-30396
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
It would make sense to have a common utility to parse
java.time.Duration
from aCharSequence
.Examples:
10ms
-> 10 milliseconds10s
-> 10 seconds10m
-> 10 minutes10h
-> 10 hoursChronoUnit
s to support:Spring Boot provides this functionality and we'd like to reuse it in Spring Data.
The text was updated successfully, but these errors were encountered: