Skip to main content


 

Symptoms


After upgrading from 4.6.6, to 4.6.10, 'Current Date' is saving with a time attached as the day before minus UTC offset in hours, when input into a 'Date/Time' field.
 

Diagnoses


In 4.6.6, there was only a single SmartObject data type 'Date/Time' which handled both formats ('1/2/03' and '1/2/03 01:02:03PM'). As of 4.6.9, these are split into 'Date' and 'Date/Time' data types as seen in the SmartObject editor. They accept input as illustrated below:

4.6.6 Date/Time SmartObject property = __/__/__
4.6.10 Date/Time SmartObject property = __/__/__ __:__:__AM/PM
4.6.10 Date SmartObject property = __/__/__

On the form, this is what the context menu 'Current Date' field pulls back:
'2003-01-02'

When this string is forced into a 'Date/Time' data type field (which it should not be), it affixes 12:00 and a UTC specific modifier (Z):
'2003-01-02 00:00:00Z'

On the SmartObject Create method, it takes in this UTC specific string, converts to the server time zone, and writes the following to the DB:
'2003-01-01 18.00.00.000'

When read from the DB, this is seen in the SmartObject tester and SmartForms as:
'1/1/2003 6:00PM'
 

Resolution

When using the “Current Date” Environment Field as an input into a SmartObject 'Date/Time' field, SmartForms sends the date in the following format: “yyyy-MM-dd”. The forms web service will then try to convert that date from UTC to Local time, and if your region is 'GMT - n' it will end up changing the date to the previous date. Example US PST being GMT -8 and the date sent in being 2016-02-17, will be converted to a local time off 2016-02-16 16:00

The recommended proactive fix is to match 'Date' input to the 'Date' data type, and 'Date and Time' input into the 'Date/Time' data type.




 
Be the first to reply!

Reply