Generate date object with the given date

/** * To generate Date Object with the given data * @param {[Number,Number,Number]} dataArray * @returns {Date} */ function generateDate(dataArray) { if (dateLogic.checkDateFormat(dataArray)) return new Date(Number(dataArray[0]), Math.abs(Number(dataArray[1]) – 1) % 12, dataArray[2]); return new Date(‘false’); } /** * @description To check whether the given date is in format of [Number,Number,Number]. ie, [YYYY,MM,DD] * @param {dateArray}… Continue reading Generate date object with the given date

Difference of As Of and Age As Of on Aging Reports

As Of refers to the date that the report will capture transactions.  If As Of is set to yesterday, then the transactions that the Aging report will include will be all the transactions dated up to yesterday’s date. Age As Of refers to the date from which the report will count the age of transactions.  If Age As Of is set… Continue reading Difference of As Of and Age As Of on Aging Reports

Converting Date to d/m/yyyy format

Scenario: Convert given date to the d/m/yyyy format Solution: You need to use the module ‘N/format‘ to convert the date to different formats. format.parse method can be use for this. It parses a value from the appropriate preference format to its raw value. The appropriate preference format is the one selected in the Date Format… Continue reading Converting Date to d/m/yyyy format

Comparing Two dates

Scenario: We have a start date and a Due date and need to a validation where Due date date should be a date after the Start date. Solution: Usually we can use the JavaScript Date() function. But you can’t compare two dates using that. Better approach to make comparison between dates is to use getTime() function. This… Continue reading Comparing Two dates