Fixes #1480. Convert DateOnly properties to local timezone#1481
Conversation
|
If this PR should still be merged, please fix the conflicts and we'll have a look at it. |
# Conflicts: # src/NJsonSchema.CodeGeneration.TypeScript/TypeScriptGeneratorSettings.cs
|
conflicts are fixed |
|
Thanks for the PR. |
|
I think this PR doesn't completely fix the issue of dates and timezones, because serialization always assumes a local timezone. Thus, if the setting ConvertDateToLocalTimezone is false, the parsing code will use new Date("2023-09-21") which assumes UTC but the formatting code calls formatDate (https://github.com/RicoSuter/NJsonSchema/blob/master/src/NJsonSchema.CodeGeneration.TypeScript/Templates/File.FormatDate.liquid) which uses This means if ConvertDateToLocalTimezone is false, you can parse and then immediately convert back to JSON and get a different result. There should also be a Then, when ConvertDateToLocalTimezone is false, the generated Then, both the serialization and deserialization will both use the same expected format and you can serialize followed by a deserialize without changing the data. |
Fixes #1480