Ensure date-time is always serialized in UTC #997
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR applies a custom directive that:
XmlDateTimeSerializationModein AutoREST's string to DateTime method fromUnspecifiedtoUtc. This ensures that date-time strings are always converted to UTC and not local time.DateTimeproperties are always serialized in UTC in AutoREST.PowerShell's.ToJsonmethod.e.g.,
2021-11-11T19:58:15.511Z->2021-11-11T19:58:15.5110000Z2021-11-11T19:58:15.511+08:00->2021-11-11T11:58:15.5110000Z[datetime]::Parse("2021-11-11T19:58:15.511Z")->2021-11-11T19:58:15.5110000Z[datetime]::Parse("2021-11-11T19:58:15.511Z").ToUniversalTime()->2021-11-11T19:58:15.5110000ZCloses #901
Closes #962
DateTimeOffsetsupport will be added by Azure/autorest.powershell#584.