Round date to year

The round date to year policy masks a date by rounding the date to January 1 of the original year. For example, August 21, 2008 would round to January 1, 2008. The format of the generated date will match the input date.

JavaScript policy syntax

This policy is available with the function DateMask.roundDateToYear().

DateMask.roundDateToYear(record.getItem(<arg:inputAttribute>), <arg:dateFormat>)

For example, to round a date to the first day of the year in MM-dd-yyyy format, enter the following syntax:

DateMask.roundDateToYear(record.getItem('/DEMO/ORDERS/ORDER_DATE'), 'MM-dd-yyyy')

Argument Description
inputAttribute The source attribute containing the date to mask.
dateFormat The format of the masked date. The default is yyyy-MM-dd. The following formats are supported:
  • dd-MM-yyyy
  • dd-MM-yyyy HH:mm:ss
  • MM-dd-yyyy
  • MM-dd-yyyy HH:mm:ss
  • MMM dd, yyyy
  • yyyy-MM-dd