Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Split creation logic of DateTime and DateTimeOffset in Utf8JsonReader - #39541

Merged
ahsonkhan merged 1 commit into
dotnet:masterfrom
layomia:datetime
Jul 16, 2019
Merged

ahsonkhan merged 1 commit into
dotnet:masterfrom
layomia:datetime

Conversation

@layomia

@layomia layomia commented Jul 16, 2019 •

Copy link
Copy Markdown
Contributor

Fixes https://github.com/dotnet/corefx/issues/39067.
I verified the fix by changing my local date settings to the settings in the issue and a few other time-zones +|- UTC.

Utf8Parser might also have this edge-case issue given that reader's parsing logic was modeled after it. I'll check.

cc @ericstj @mholo65 @steveharter fyi.

}

[Fact]
public static void Regression39067_TestingDateTimeMinValue()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to run this in RemoteExecutor and locally modify the timezone used? Not sure if that's possible or not, I'd imagine we might have similar requirements for DateTime types though.

@layomia layomia Jul 16, 2019 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to do this before but was advised that this can affect other tests, or the test might crash and we'll not be able to revert the system settings.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to run this in RemoteExecutor and locally modify the timezone used?

Time zone setting is user global setting and not process setting. I wouldn't recommend that.

public int OffsetMinutes;
public bool OffsetNegative => OffsetToken == JsonConstants.Hyphen;
public byte OffsetToken;
if (!TryParseDateTimeOffset(source, ref parseData))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is DateTimeParseData being passed by ref here rather than the TryParseDateTimeOffset new-ing one up and returning as an out?

}

[Fact]
public static void Regression39067_TestingDateTimeMinValue()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Add a link to the issue within a comment.

@ahsonkhan ahsonkhan added this to the 3.0 milestone Jul 16, 2019
@ahsonkhan
ahsonkhan merged commit 05c0f51 into dotnet:master Jul 16, 2019
@ahsonkhan

ahsonkhan commented Jul 16, 2019 •

Copy link
Copy Markdown

This change will not affect packaging (the only CI leg left), so it's fairly safe to merge.

@bjorkstromm

Copy link
Copy Markdown
Member

@layomia tested this PR locally, now only six tests fail for me in JSON, but these are due to issues in tests. I'll send a PR to fix them.

@layomia
layomia deleted the datetime branch July 16, 2019 19:36
@layomia

layomia commented Jul 16, 2019

Copy link
Copy Markdown
Contributor Author

@layomia tested this PR locally, now only six tests fail for me in JSON, but these are due to issues in tests. I'll send a PR to fix them.

Awesome, thanks!

@karelz

karelz commented Aug 3, 2019

Copy link
Copy Markdown
Member

This change made it into release/3.0 with the last integration from master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.Text.Json Deserialization - Can't parse DateTime.MinValue if UTC offset is greater than 0

6 participants