Problem using addDays with UK date format
Hi everyone, I'm trying to get a date field (Due Date) to be automatically calculated by adding 2 days to another date field (Date Received) using the code below:
if (typeof [[Date_x0020_Received]] !== 'string') {
return [[Date_x0020_Received]].addDays(2);
}
return null;
However, this is calculating the incorrect date as shown below:

It seems to be adding to the month value rather than to the days. I assume this is something to do with the locale as the code seems to be operating using US format where we are using UK format for dates. I've tried adding .localeFormat("dd/MM/yyyy") to the above code but this makes no difference.
I'd be grateful if someone could let me know if there's anything I'm doing wrong or a way around this?
-
Hi Gareth Jayne
Just try to reproduce your described issue. It's working in my site as expected:

I changed Regional Settings to "English (United Kingdom)" and configured the Calculated expression with your code.
Which version of Rich Forms is in use? In latest release was a fix for calculations with different regional settings. Have a look here: skybow Rich Forms Full Trust 3.1.27.7
0 -
Thank you very much. I've updated to version 3.1.27.7 and all now working as expected.
0
Please sign in to leave a comment.
Comments
2 comments