-
what is dataviewjs equivalent of the following `= date(today) - this.date ` ?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Use const { DateTime, Duration } = luxon
const otherDate = DateTime.fromObject({ years: 3000, hours: 13, minutes: 37 })
const thatDuration = Duration.fromISOTime('13:37')
const thatIntervalButActuallyAnotherDuration = this.date.diffNow() // documentation says this returns an Interval but it's actually a Duration. Don't know why.
console.log(thatIntervalButActuallyAnotherDuration.plus(thatDuration).toObject()) |
Beta Was this translation helpful? Give feedback.
-
Unfortunately |
Beta Was this translation helpful? Give feedback.
Use
this.date.diffNow()
orthis.date.until(otherDate)
. And sinceluxon
is available from inside dataviewjs, if you need to create newDateTime
objects, you can do something like