Hello,
I was trying to create a trigger/batch job that would take on a date in UTC format and assign it to a javascript date object. However, every time I try to do this, it gives me an invalid date. Is this something to do with the server-side javascript engine?
This converts to a valid javascript date object on client-side but not server-side. Any reasons why?
Code:
var dateVal = new Date("2016-11-04T15:50:54.0664381+00:00"); // results in Invalid Date
Hello Iram,
Parsing Date string literals into Date objects can be an issue with specific date formats.
Can you please consider passing a long argument i.e. time in milliseconds instead to Date construction or Date.valueOf.
Else, you can leverage Moments.js JavaScript library for server-side scripts. Attached is a sample application exhibiting the same.
[View:/cfs-file/__key/communityserver-discussions-components-files/25/TestMomentsJS_5F00_v1.xml:320:80]
Have you tried using rbv_api.getFieldValue() instead of your date's token?
It might give you a properly formatted date.
Also, you might want to look into rbv_api.formatDate(date, pattern) for future reference
Hope this helps.