Infopath 2010 addSeconds and DatePicker issues (bug or not...) - InfoPath Dev
in

InfoPath Dev

Infopath 2010 addSeconds and DatePicker issues (bug or not...)

Last post 03-10-2013 04:34 PM by 2e2forevesMan. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 03-10-2013 04:34 PM

    Infopath 2010 addSeconds and DatePicker issues (bug or not...)

    I had an Infopath2007 form that was used to record scheduled maintenance events.  The users would input the maintenance start and end times in UTC/ZULU format.  The customers and technicians would receive a report where the times were converted to local - this was all done in the form itself.

    Here's how:

     

    ZuluStartTime: dateTime field selected with a Date Picker

    DSTOffset: Integer field selected with drop-down choices that would add the appropriate offset for local time (central) conversion (-18,000 or -21,6000)

    LocalStartTime: Read Only dateTime field with calculated value (addSeconds(ZuluStartTime,DSTOffset)

     

    This worked great for years.  Then....

    The organization upgraded the clients to Infopath 2010, and after that point the converted times were off by 6 hours.  This corresponds to the time zone we are located in - so there was the correlation.  But I needed to see what changed (other then just create a work around).

     It could be 3 things - the DateTime data type, the Date Picker object, or the addSeconds function.

    DateTime data type:  I created 2 variables - startTime and copyStartTime.  Both were DateTime types with a Date Picker.  I set copyStartTime's default value to startTime.  This calculated correctly.

    addSeconds function:  I created 3 variables - startTime and newStartTime (both DateTime types with a DatePicker) and offset (integer).  default values: startTime = now(), offset = 0, newStartTime = addSeconds(startTime, offset).   Both startTime and newStartTime displated the same time.  However, when I selected differnt time using the date picker for startTime, newStartTime jumped forward 6 hours (remember offset is 0).

    Turns out that the Date Picker field returns the time in a converted to UTC format.  (it displays local time, but the variable is stored as UTC)  So the user picks a time, and it is automatically converted to UTC and stored.  If you perform a calculation on that field (addSeconds), it is performing the action on the UTC time.  When you redisplay the modified dateTime, it now displays in UTC.  Infopath 2007 did not perform that way. 

    AddSeconds is the only way to modify a dateTime that I am aware of.  It does not act as a infopath dev would expect it to act. 

     

    I am not a Microsoft hater (I even support the ribbon in SOME applications -- not paint and not Sharepoint 2010), and this is really the first thing I think they made a mistake with that I have found.

    Would you consider this a bug?  Or just another thing to work around and have break when the rules change again.

     

    laters.


     

     

     

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.