Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Handling time values with timezone differences

    Hi,
    I am fighting a bit what the best approach is to handle time values when the client and server have different timezones (and different clients could have different timezones).

    In any case, what I tried is to send the time converted to utc time to the server and send the time in utc back to the client. I noticed that smartclient sends the utc time to the server for a time field (following the callpath; JSONEncode._serialize --> Serialize.encodeDate --> date.toSchemaDate), the time is send as a datetime in utc to the server.
    That's fine.

    But when I send the time back to the client from the server, smartclient converts it back assuming that it is in the local client's timezone. The Time.parseInput is being used (called from validatorDefinitions.isTime.condition --> Time.parseInput(value, true).

    To solve this I would need to follow one of the 2 approaches (utc back and forth or no conversion back and forth from the client to the server and vv).

    So my question... how can I achieve one of the following in smartclient:
    1- no conversion to utc when sending a time to the server
    or
    2- utc conversion when receiving from the server

    I am leaning more and more to option 1 (no conversion at all). It gets all quite difficult with daylight saving time which can only be applied correctly if you know on which date the time is.
    But even for not converting with timezone, I would need to prevent the utc conversion when sending from the client to the server. (question/option 1 above)

    Thanks for any insights on this!

    gr. Martin

    #2
    Please read the Date and Time Format and Storage topic for an overview.

    If you have further questions after reading this, please be much more specific:

    1. are you talking about date, time or datetime values? For one, for values for fields of type "time" values, there's no such thing as a UTC value (the value does not have a date at all).

    2. be specific about what protocol is being used - RestDataSource, some thing

    3. be specific about the values you are passing and how you are examining them such that you believe you are seeing changes in value or timezone, and be sure to pay special attention the Date and Time Format and Storage for common mistakes made in this area.

    Comment


      #3
      Martin,

      Did you ever come to any solution?

      I am having timezone issues as well unfortunately....

      Comment

      Working...
      X