We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The documentation states:
For DateTimeOffset values, the "K" format specifier is equivalent to the "zzz" format specifier [...]
while this may be the case for serialisation, this behaviour differs when deserializing time strings as shown in the example below.
const string inputWithOffset = "2023-08-31T07:00:00+02:00"; const string utcInput = "2023-08-31T07:00:00Z"; const string inputWithoutOffset = "2023-08-31T07:00:00"; DateTimeOffset.ParseExact(inputWithOffset, "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", null, DateTimeStyles.None); //works DateTimeOffset.ParseExact(utcInput, "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", null, DateTimeStyles.None); //works DateTimeOffset.ParseExact(inputWithoutOffset, "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", null, DateTimeStyles.None); //works DateTimeOffset.ParseExact(inputWithOffset, "yyyy'-'MM'-'dd'T'HH':'mm':'sszzz", null, DateTimeStyles.None); //works DateTimeOffset.ParseExact(utcInput, "yyyy'-'MM'-'dd'T'HH':'mm':'sszzz", null, DateTimeStyles.None); //FormatException DateTimeOffset.ParseExact(inputWithoutOffset, "yyyy'-'MM'-'dd'T'HH':'mm':'sszzz", null, DateTimeStyles.None); //FormatException
→ the "zzz" specifier does not allow the "Z" offset and a missing offset, while the "K" specifier accepts those.
I think this is worth to be mentioned in the documentation.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the issue or suggestion
The documentation states:
while this may be the case for serialisation, this behaviour differs when deserializing time strings as shown in the example below.
→ the "zzz" specifier does not allow the "Z" offset and a missing offset, while the "K" specifier accepts those.
I think this is worth to be mentioned in the documentation.
The text was updated successfully, but these errors were encountered: