Skip to content
New issue

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

Improve handling a datetime field in a sub-type #113

Merged
merged 2 commits into from
Sep 23, 2020

Conversation

steco
Copy link
Contributor

@steco steco commented Sep 21, 2020

I ran into an issue where a subtype containing a date field was not deserialised correctly (it appeared that the timezone of the date was changed to my local machine's timezone). This is an attempt at a fix based on a workaround I found for this issue, but would appreciate it if there was a better solution.

@steco steco force-pushed the feature/handle-dates branch from 99796bd to 4733631 Compare September 21, 2020 17:31
@steco steco force-pushed the feature/handle-dates branch from 4733631 to cf1e58a Compare September 22, 2020 19:02
Update test to use JsonSubtypes converter
@manuc66 manuc66 merged commit 8f09d72 into manuc66:master Sep 23, 2020
@steco steco deleted the feature/handle-dates branch September 24, 2020 10:40
@manuc66
Copy link
Owner

manuc66 commented Sep 10, 2022

Hello,

The issue should apparently not have been solved in this library, if you want the deserialization to happen as you expect you should deserialize with that settings;

            var obj = JsonConvert.DeserializeObject<MainClass>(json, new JsonSerializerSettings
            {
                DateParseHandling = DateParseHandling.DateTimeOffset
            });

The way it has been solved cause #120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants