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
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
Comment