How does OS work with date time values that are passed to JS script?

How does OS work with date time values that are passed to JS script?

  

Hi,

I've noticed that when I store date time value to local storage during sync process the time is converted to local timezone assuming that values are passed in UTC. So if I want to store time as is (I've made server-side conversion etc.) I have to use text attribute in local storage entity. And currently I'm wondering how OS dials with date time values if they are passed to js scripts or Cordova plugins like Local Notifications  - does it apply any conversion and if so is three a setting to prevent that? 

For example in my test I have a client action that has AddHours() function when assigning values to a variable and the result I show in browser console differs when I change my device timezone on operating system settings.


Thank you very much in advance

Hi Mykola,

The DateTime data type is timezone aware. If you want it to be timezone independent you may instead use a Date and a Time, which don't take the timezone into consideration.

Considering the JavaScript node, a DateTime value is converted to a JavaScript Date object. These objects have methods to access both the local time and the UTC time (ex: getDate() and getUTCDate())


Let me know if you need any more clarification.