You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create factory function Duration for duration objects (time-period, span, stretch), like 3 days, 4 hours, 25 minutes.
Some resolution units to consider, each can be negative, at least one needs to be given:
Time-level:
milliseconds
seconds
minutes
hours
Days-level:
days
weeks
Months-level:
months
quarters
years
decades
centuries
millennia
Upon object creation, normalize / balance to the largest given unit within each level.
Properties and methods:
iso
toString() => iso
toJson() => iso
valueOf() => number tally milliseconds
is(other: Duration) => boolean equality check
round() => Duration
rescale(shape: SloppyDuration) => Duration
add(duration: Duration): Duration
subtract(duration: Duration): Duration
asHours(), asDays(), etc
Use Intl number format to localise strings using units. See how Luxon does this!
Check Temporal for balancing https://tc39.es/proposal-temporal/docs/balancing.html and compare that to Luxon's round, rescale & shift!
The text was updated successfully, but these errors were encountered:
Create factory function
Duration
for duration objects (time-period, span, stretch), like 3 days, 4 hours, 25 minutes.Some resolution units to consider, each can be negative, at least one needs to be given:
Time-level:
milliseconds
seconds
minutes
hours
Days-level:
days
weeks
Months-level:
months
quarters
years
decades
centuries
millennia
Upon object creation, normalize / balance to the largest given unit within each level.
Properties and methods:
iso
toString() => iso
toJson() => iso
valueOf() => number
tally millisecondsis(other: Duration) => boolean
equality checkround() => Duration
rescale(shape: SloppyDuration) => Duration
add(duration: Duration): Duration
subtract(duration: Duration): Duration
asHours()
,asDays()
, etcUse
Intl
number format to localise strings using units. See how Luxon does this!Check Temporal for balancing https://tc39.es/proposal-temporal/docs/balancing.html and compare that to Luxon's round, rescale & shift!
The text was updated successfully, but these errors were encountered: