Skip to main content

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:

2d6ef91b9c8c0b441ea4a6d4867c8542faf993eb.jpg

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

14b67b8cb98dbca1bfa8daa7c93975b435c22952.jpg

How it looks in the test org when user’s time zone is reset to GMT+109fcb216fad93377300d6df6ca23a774e7ba92329.jpg


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 = rowsanumRows-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:o<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
a421b1c3b4b23bb4c06513fe4f57938ef10d8671.png