You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Javascript API: Day offset when setting a date field in the workspace

Received Response
11
Views
3
Comments
edited Feb 8, 2018 8:15AM in Customer Portal 3 comments

Content

I'm using jQuery UI's datepicker on a page (which is run inside a browser control) and when a date is selected, I'm executing the following code:

jQuery('.isDate').datepicker({
   onSelect:function(datestring, inst)
   {
      var timestamp = new Date(datestring).getTime()/1000; // datestring will be in mm/dd/yyyy format (02/15/2018)
      window.external.Incident.setCustomFieldByName('c$date_marked', timestamp); // gets populated as 02/13/2018
   }
});

According to the Javascript API documentation,

A date-time value expressed as an integer in unix time format

I realize that it is due to the timezone difference between the client and server, but how would I go about syncing them together dynamically? i.e. without having to hardcode the timezone difference?

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!