From 64e8dd7c043d76939d66acf12f465959fb4f1023 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 14 May 2021 13:37:37 +0200 Subject: [PATCH] Convert dates back from ISO when parsed When converting data to a JSON values of type VBA.vbDate, datetimes are converted to ISO format, thus adjusting the local time to global time. However, when parsing the same json result back, the time unit stays in global time unit. By adding this line of code the conversion happens both ways. See also extended comment here: https://github.com/VBA-tools/VBA-JSON/issues/169#issuecomment-841180355 --- JsonConverter.bas | 2 ++ 1 file changed, 2 insertions(+) diff --git a/JsonConverter.bas b/JsonConverter.bas index 876b865..0eb6487 100644 --- a/JsonConverter.bas +++ b/JsonConverter.bas @@ -592,6 +592,8 @@ Private Function json_ParseString(json_String As String, ByRef json_Index As Lon End Select Case json_Quote json_ParseString = json_BufferToString(json_Buffer, json_BufferPosition) + 'only test for same ISO format in ConvertToIso method + If json_ParseString Like "####-##-##T##:##:##.###Z" Then json_ParseString = ParseIso(json_ParseString) json_Index = json_Index + 1 Exit Function Case Else