Announcement

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

    Shouldn't the RestDataSource send timezone offset of client?

    SmartClient Version: SNAPSHOT_v9.1d_2013-09-08/LGPL Development Only (built 2013-09-08)

    Firefox 14

    After reading the Date and Time Format and Storage doc it seems that when sending a json request any field of type "datetime" should send it in "yyyy-MM-dd'T'HH:mm:ssZ"

    According to docs
    When sent or received in XML or JSON, datetime field values should be serialized out as full datetimes using the standard XML Schema date format (EG:2006-01-10T12:22:04-04:00)

    If you have a field of type "datatime" you get the Date-Time picker which sets the current time from the client, but the POST json does not send the offset. Example, Client is in EST or UTC -05:00 or Daylight Savings -04:00 so I would expect to see the current time and -05:00 sent to the server.

    Currently the RestDataSource sends a datetime like
    "datetime":"2013-10-09T01:20:00" (No offset)
    but shouldn't it be "datetime":"2013-10-09T01:20:00-04:00" or whatever the client UTC offset is ie. if someone from San Diego opened the web app it would be an offset of -07:00

    It seems the clients offset is being dropped from the json request.

    Thanks,
    Dan

    #2
    As the overview states, times are always sent in UTC, which is unambiguous and does not depend on the client's offset. This is widely considered a best practice.

    Comment


      #3
      The problem that I see with this is that you still do not know the clients timezone. So if I enter a transaction at 9am and I am in EST and the server is in EST and another user enters a transaction at 9am but they are PST, both transactions show as posted at 9am but in reference to the server time being EST the transaction was really entered at 6am. However without the offset being transmitted I have know way of knowing the actual time it was entered relative to EST. There are lots of reasons you would want to know the local time that a record was saved to database.

      From my understanding UTC does include offsets just like GMT for this very reason. And in your document specs you say that datetimes should transmit full value.

      When sent or received in XML or JSON, datetime field values should be serialized out as full datetimes using the standard XML Schema date format (EG:2006-01-10T12:22:04-04:00)

      Which includes the clients timezone offset. Is there a way to get the RestDataSource to include the clients offset?

      Thanks,
      Dan

      Comment


        #4
        In rare situations, the server might be interested in the client's timezone offset, but it is not needed for reliable transmission of dates.

        Also, including it in the network serialization format does not magically mean the client timezone will be stored into a database. You would generally need to set that up as a separate database column, hence DataSourceField.

        Comment


          #5
          Thanks, that makes sense.

          Appreciate the help!

          Dan

          Comment

          Working...
          X