Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Discussion options

You must be logged in to vote

I suspect what's biting you is that your DateTime.Kind is set to = Unspecified. The MessagePack format requires that all date-time values are serialized as UTC (which is good). But this means that if you leave Kind as Unspecified, we assume it is already (IIRC) UTC and serialize it as such. Then when we deserialize it and you look at Local time, it may be shifted by your time zone if the original Unspecified value was actually local time.

So take care to set Kind on all your DateTime's before serialization, and you should find the time comes back as intended.

Relevant code:

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by AArnott
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants