Hi,
I am in a scenario where date is causing problem. I have a date picker when selected date is of format dd.mm.yyyy (German). I need to then pass to REST API(Sharepoint) where it allows time containing Z (zulu=>UTC). So i converted the date like this
var tmpAuditDate = $(this).parent().find('[id*=Date]').val();
var auditDate = "";
if (tmpAuditDate) {
var dString = tmpAuditDate.split(dateSeparator);
if (dateSeparator == ".") {
auditDate = new Date(dString[2], dString[1] - 1, dString[0]);
}
else {
auditDate = new Date(dString[2], dString[0] - 1, dString[1]);
}
auditDate.setDate(auditDate.getDate());
}
I got the audit date as this "Tue Feb 3 00:00:00 UTC+0530 2015" but when i pass it to REST it throws an error, primitive types are not allowed and when i checked the rest api result its in Edm.DateTime format. So i converted the date using this
auditDate.toISOString()
Although it was saved successfully the date i got the result like this "2015-02-02T18:30:00.000Z", which is a day back.
So how can i achieve this.
Also i saw an implementation of ISOString convertion if browser doesnot support the function as specified here
ISO
But where shall i put this???
Thanks in advance
Arjun Menon