I need some help with switching the format from DD-MM-YYYY or MM-DD-YYYY to ISO Standard (YYYY-MM-DD)in JavaScript. I'm using this on a custom URL Button.
This is what i'm doing, and It is working fine for US date formats but not working for EU dates. I get invalid date error.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
var Lastdate = new Date('{!ServiceContract.EndDate}');
How can I instantiate a Date
when using a different locale?
Best Answer
Yes, it will give an issue due to locale.
So, better retrieve year, month and day portion from the date and create a Date instance based on those parameters.
It will solve locale related issues.