Skip to content
Advertisement

calculating next date to the passed Date in WSO2 6.1.1 using script

I am trying to get next day of Date to the passed date.

Reading dates from registry file.

Registry look like this

splitting above content by using colon separator and consider this as startDate and EndDate. Using script mediator to add Next day of Date for both dates. because after process done, i need to update registry with Next Days Date.(not yet included here, only date conversion is included)

JavaScript

Logs:

JavaScript

Expected Output:

NextStartDate: 2020-12-02 NextEndDate: 2021-01-01

References: Date Conversion Link

Advertisement

Answer

You dont need to call new Date() since you have the date string already and Date object you have used is javascript object. Tryout this code. Dates are hardcoded here

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement