-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSONRPC incorrectly decodes UTC values for DateTime Params #560
Comments
Interestingly, in my mind I had always conflated UTC and ISO8601. Having read this SO entry (https://stackoverflow.com/questions/58847869/utc-vs-iso-format-for-time) I now see that ISO8601 is the structure of the underlying data, and UTC, GMT, local time etc are presentation formats.
|
Given that the subsequent call to ISOTimeStampToDateTime fails if the timestamp is less than 19 characters long i.e. of the form that omits the dash date separators
|
Thanks for testing and accepting the changes. I'll close the ticket. |
We have a JSONRPC method with this signature
function EndPractitionerRole(ID: Int64; LastUpdated: TDateTime): Boolean;
We send data
{"jsonrpc":"2.0","id":926270,"method":"EndPractitionerRole","params":{"ID":1203521835,"LastUpdated":"2022-06-10T09:08:25+12:00"}}
As our current local UTC offset is +12 hours, we are expecting to see a local datetime in the method's parameter of
9:08:25 am on 10 June 2022
Instead we see a local datetime of
9:08:25 pm on 09 June 2022
which is 12 hours earlier i.e. it misses the offset.NB: We also see the same behaviour if the JSON contains a zulu coded value i.e.
2022-06-09T21:08:25Z
This is caused by the mapping performed by
JSONDataValueToTValueParam
The code in the following snippet will never call the code in the else part because by definition all UTC date times must contain "T"
And the code in the underlying
JsonDataObjects
has a hard coded False for the "useLocalTime" param in the call to return UtcDateTimeValueIn the debugger if I jump into the else part so the
ISOTimeStampToDateTime
method is called then the correct value appears in the JSONRPC method's parameter.The text was updated successfully, but these errors were encountered: