Skip to content

Commit

Permalink
Tested best implementation of DateTimeStyles.RoundtripKind
Browse files Browse the repository at this point in the history
  • Loading branch information
gjdonkers committed Jun 12, 2021
1 parent eb00bed commit a980a34
Showing 1 changed file with 1 addition and 4 deletions.
Expand Up @@ -91,10 +91,7 @@ bool INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func<IPars

case TypeCode.DateTime:
// TODO: This is probably incorrect. Use the correct regular expression.
var style = scalar.Value.EndsWith("Z")
? DateTimeStyles.RoundtripKind
: scalar.Value.Length > 27 ? DateTimeStyles.AssumeLocal : DateTimeStyles.None;
value = DateTime.Parse(scalar.Value, CultureInfo.InvariantCulture, style);
value = DateTime.Parse(scalar.Value, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
break;

default:
Expand Down

0 comments on commit a980a34

Please sign in to comment.