snippet populating date varies according to user's Time Zone setting

I have a snippet which is prepopulating a dateTime field, from a previous row in the same model, OR if there are no previous rows, then date should be null and time 00:00

This seems to be working fine in our dev org and packaging org, but in a test org the ‘time’ component (which should be 00:00) actually varies according to the user’s time zone setting.

How it looks in the dev org when first row is populated:



How it looks in the test org when first row is populated: (user’s time zone set to GMT+2)



How it looks in the test org when user’s time zone is reset to GMT+10


Any ideas as to why this could be happening? And how to make this snippet populate a 00:00 value for the time (across multiple orgs and user time zone variations)

Snippet below:

var $ = skuid.$, &nbsp;&nbsp;&nbsp; &nbsp;params = arguments[0],<br>&nbsp; &nbsp;model = params.model,<br>&nbsp; &nbsp;<br>// Create a new row in our Model,<br>// with the stack__Date__c field defaulted to the same date as the last row in the table &nbsp;&nbsp;<br>rows = model.getRows(),<br>numRows = rows.length,<br>defaultDate;<br>&nbsp; &nbsp; &nbsp; &nbsp; // If we have a previous row, default it to that rows date &nbsp;<br>if (numRows) defaultDate = rows[numRows-1].stack__Date__c;<br>&nbsp; &nbsp; &nbsp; &nbsp; // Otherwise default it to NOW / TODAY<br>&nbsp; &nbsp; &nbsp; &nbsp; //else defaultDate = 'TODAY';<br>else defaultDate = null;<br>//Create the row<br>model.createRow({<br>&nbsp; &nbsp; additionalConditions:[<br>&nbsp; &nbsp; &nbsp; &nbsp; {field: 'stack__Date__c', value: defaultDate}<br>&nbsp; &nbsp; ],<br>&nbsp; &nbsp; editModeForNewItems: true,<br>&nbsp; &nbsp; doAppend: true<br>});









Basically, date/time fields leaving/entering the object do not use time zones. Everything is UTC ("+0000").

So, basically, convert everything to that time zone before saving it in SF.

http://help.skuidify.com/m/11720/l/129505-skuid-time