JavaScript API duration in Dateview

Hi all,

I’m trying to figure out how to print a custom date format using Dateview. I can get it working inline:

=date(this.Completed) - date(this.Started)

(Side note: this prints “weeks” even if there’s only a single week, and I assume it will be the same for “days”. Is there a way to fix this outside of figuring out the below?)

However I can’t for the life of me figure out what I’m doing wrong with the JavaScript API:

const page = dv.current();
const range = page.Completed - page.Started;

dv.span(range); // prints 864000000
dv.span(range.days); // null
dv.span(dv.duration(range)); // No implementation of 'dur' found for arguments: number

I must be missing something incredibly obvious. I basically want to be able to format the amount of weeks and days between two dates myself.

Any help is greatly appreciated!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.