moment

manipulate dates

You can use the very good library moment to manipulate the dates

const fromDate = moment.utc(FW.getEvent().computedDate).add(-2, 'days');

The function diff is often used. Note that the order to use is like if you substracted. If the left is greater than the right, the diff is positive.

const now = moment.utc();
const tomorrow = moment(now).add(1, 'day');
FW.log(tomorrow.diff(now))

// returns 86400000

Last updated

Was this helpful?