brixxbox Wiki
Ask or search…
Comment on page

The moment.js Library

brixxbox includes the following client side libraries to deal with date, time and durations and calculations in that area.
//format a date
var myMoment = moment(app.getFieldValue("myDateField"));
console.log(myMoment.format("lll")); //Jul 13, 2020 1:02 PM
//simple format a duration
moment.duration(123, "minutes").format(); //2:03:00
//how old is the value in myDateField
var myDuration = moment().diff(moment(app.getFieldValue("myDateField")), "seconds");
moment.duration(myDuration, "seconds").format();