Object for manipulating dates and times.
This is a third party object from Moment.JS, exposed to use in rulesets.
(client and server-side function)
Note : for Formbird v3.1.x and onward, moment.js is no longer automatically included. You will need to add the rulesetInclude "Moment.js"
This is a quite powerful library, which is beyond the scope of a simple function outline. See further reading below.
Note - Setting Date fields
Ensure when setting to date-time document properties, to use the method .toDate() to render as a date object, rather than setting the field to the moment object itself.
var nbrHours = parseFloat(ntf.newValue); var nbrMinutes = nbrHours * 60; ntf.logger.info('Hours to offset: ' + nbrHours); var tempMoment = ft3.moment(ntf.document.finishDate); tempMoment.add(nbrMinutes, 'minutes'); ntf.document.checkInTimeInitial = tempMoment.toDate();
More detail can be found at Moment.js documentation