RelativeDurationLocalizer
Localizes a single Duration unit (usually the biggest one) in a relative way.
The localize function returns a TickingValue value indicating when a new localize call is required to update the value.
For the purposes of TickingValue.nextTick, this class assumes that the given Duration is obtained from a computation that linearly "moves" backwards, i.e. a positive duration means something that will happen in the future, and a negative duration something that has happened in the past. For instance, if given the duration 10 seconds, this class assumes that in 1.5 seconds the Duration would be 8.5 seconds.
The output string will contain the correct localized words for "in" and "ago". If you just need the "next tick" behavior but do not want the relative localization, you can use TickingDurationLocalizer instead.
Examples:
10 minutes agoin 1 hour4h ago4 hr. agoin 2 days
Localizes a single Duration unit (usually the biggest one) in a relative way.
The localize function returns a TickingValue value indicating when a new localize call is required to update the value.
For the purposes of TickingValue.nextTick, this class assumes that the given Duration is obtained from a computation that linearly "moves" backwards, i.e. a positive duration means something that will happen in the future, and a negative duration something that has happened in the past. For instance, if given the duration 10 seconds, this class assumes that in 1.5 seconds the Duration would be 8.5 seconds.
The output string will contain the correct localized words for "in" and "ago". If you just need the "next tick" behavior but do not want the relative localization, you can use TickingDurationLocalizer instead.
Examples:
10 minutes agoin 1 hour4h ago4 hr. agoin 2 days
Localizes a single Duration unit (usually the biggest one) in a relative way.
The localize function returns a TickingValue value indicating when a new localize call is required to update the value.
For the purposes of TickingValue.nextTick, this class assumes that the given Duration is obtained from a computation that linearly "moves" backwards, i.e. a positive duration means something that will happen in the future, and a negative duration something that has happened in the past. For instance, if given the duration 10 seconds, this class assumes that in 1.5 seconds the Duration would be 8.5 seconds.
The output string will contain the correct localized words for "in" and "ago". If you just need the "next tick" behavior but do not want the relative localization, you can use TickingDurationLocalizer instead.
Examples:
10 minutes agoin 1 hour4h ago4 hr. agoin 2 days