I have a snippet which retrieves a DateTime field from multiple rows in a child model, converts each date to a string, and concatenates each date with a line break into a long text field on the parent model. (So that I can then send an html email template with this long text field included).
Snippet below:
var $ = skuid.$;<br> var parentEnquiry = skuid.model.getModel('CharterOpParent');<br>var parentRow = parentEnquiry.getFirstRow();<br>var Sectors = skuid.model.getModel('Sectors');<br>var descField = '';<br> $.each(Sectors.data, function (i, row){ //iterate over the rows<br> var jsDateTime = skuid.time.parseSFDate(row.stack__Date__c);<br> var jsDate = jsDateTime.toDateString();<br><br> descField += jsDate + '
';<br> console.log(jsDateTime);<br> console.log(jsDate);<br> });<br> console.log('************');<br>console.log(descField);<br> parentEnquiry.updateRow(parentRow,'stack__Special_Requirements__c',descField);
The issue with this is that it appears to be converting the time displayed in the browser into the current user’s locale. For example, if I enter two child rows with dates of:
26/11/2014 23:00
29/11/2014 00:00
Then the output the snippet populates into the long text field is:
Wed Nov 26 2014
Fri Nov 28 2014
Is there a different method to have this snippet retrieve the ‘actual’ time displayed on the users browser? (without any conversion for current user’s locale?)