Initially, I was wondering what if we stick using useCustomaryWords in its boolean form plus always using the customary word for 0. For example, .formatRelativeTime( count, unit, options )
:
(count, unit) | options = {} |
options = { useCustomaryWords: false } |
---|---|---|
( 2, "day" ) |
"in 2 days" |
"in 2 days" |
( 1, "day" ) |
"tomorrow" |
"in 1 day" |
( 0, "day" ) |
"today" |
"today" |
( -1, "day" ) |
"yesterday" |
"1 day ago" |
( -2, "day" ) |
"2 days ago" |
"2 days ago" |
( 2, "second" ) |
"in 2 days" |
"in 2 seconds" |
( 1, "second" ) |
"in 1 second" |
"in 1 second" |
( 0, "second" ) |
"now" |
"now" |
( -1, "second" ) |
"1 second ago" |
"1 second ago" |
( -2, "second" ) |
"2 days ago" |
"2 seconds ago" |
The problem is that we won't allow countdowns of the form "in 2 seconds", "in 1 second", "in 0 seconds", which could potentially be worked around with decimals. For example:
(count, unit) | options = {} |
options = { useCustomaryWords: false } |
---|---|---|
( 0.1, "day" ) |
"today" |
"in 0 days" |
( 0, "day" ) |
"today" |
"today" |
( -0.1, "day" ) |
"today" |
"0 days ago" |
( 0.1, "second" ) |
"now" |
"in 0 seconds" |
( 0, "second" ) |
"now" |
"now" |
( -0.1, "second" ) |
"now" |
"0 seconds ago" |
Not very clear though.