4 ms·
I’d like to have interval types for example const D = new Temporal() const t = new Interval({minutes:5}) const v = D.add(t)
by tmpfile 7mo ago
I’d like to have interval types for example
const D = new Temporal()
const t = new Interval({minutes:5})
const v = D.add(t)
- nikeee 7mo agoIt is called Duration.
- jitl 7mo agoa much less ambiguous name than Interval
- plastic041 7mo agoThat's Duration! const D = Temporal.PlainDate.from("2020-06-16"); const t = Temporal.Duration.from({ day: 1 }); const v = D.add(t) // 2020-06-17 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- mkobit 7mo agoAt least in java.time (which I believe an inspiration for Temporal) Duration (https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/Duration.html https://docs.oracle.com/en/java/javase/21/docs/api/java.base...) is a time-based measure of time. For example, 5 hours, 59 minutes, and 15 seconds. Period (https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/Period.html https://docs.oracle.com/en/java/javase/21/docs/api/java.base...) is a date-based measure of time. 2 years, 3 months, and 4 days. Interval (https://www.threeten.org/threeten-extra/apidocs/org.threeten.extra/org/threeten/extra/Interval.html https://www.threeten.org/threeten-extra/apidocs/org.threeten...) isn't built into java.time, however, it is in the popular threeten-extra library. The docs say "An interval represents the time on the time-line between two Instants." The main difference being that Interval is anchored to the timeline while Duration and Period are not.