01 Nov 2021 04:29 AM - edited 01 Nov 2021 04:31 AM
May I know what was wrong with the commented-out lines?
I am trying to set future dates using API, but it will not work.
//var curdate = new Date();
//var arriveDate = curdate.getTime() + 5 * 24 * 60 * 60 * 1000;
//var departDate = curdate.getTime() + 6 * 24 * 60 * 60 * 1000;
//api.setValue("arrriveDate", api.dateToFormat(arriveDate, "dd/MM/yyyy"));
//api.setValue("departDate", api.dateToFormat(departDate, "dd/MM/yyyy"));
// below works
api.setValue("arriveDate", "09/11/2021");
api.setValue("departDate", "10/11/2021");
Solved! Go to Solution.
02 Nov 2021 02:44 PM
Nothing seems to be wrong with your lines. Can you try to use api.getValue like below to see the output.
api.setValue("arrriveDate", api.dateToFormat(arriveDate, "dd/MM/yyyy"));
api.info(api.getValue("arrriveDate"));
We have to use api.getValue() to get the value of the key previously set by api.setValue().
Regards,
AK