-
Notifications
You must be signed in to change notification settings - Fork 603
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
Relative time: Additional features #391
Labels
Comments
This was referenced Feb 12, 2015
Closed
On CLDR v26, different widths/forms appeared: I've also (a) made the API more similar to |
Ecma proposal: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
value
as number unit)Support relative times:
API
Examples:
Value: Object with
from
andto
keys and Date instance values, or a Date instance (considered to be theto
value andfrom
defaults to now (new Date()
)), or a Number (positive numbers represent future, negative numbers represent past).Unit: Optional when
value
is a Date instance or an object of Date instances. Required whenvalue
is a Number. Possible values are (year, quarter, month, week, day, hour, minute, and second), e.g., "in 30 days", "in 4 weeks", or "in 1 month", ... Defaults to automatic detection when using Date instances, therefore implementing a simple approximation algorithm [1]. But, delegating any more complex things to a specific date manipulation library such as moment.js.Options:
1:
(analogous for future)
CLDR
Relative time fields can be found on /dateFields.json.
Other
References:
This issue succeeds #205 (discussion to get to the API above). For absolute durations, see
.formatUnit()
in #252.The text was updated successfully, but these errors were encountered: