Skip to content

normalizing json serialization settings in statemanager #505

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

Merged
merged 1 commit into from
Apr 1, 2025

Conversation

slorello89
Copy link
Member

Fixes #504

We recently fixed an issue with DateTime's / DateTimeOffsets not being properly serialized in Update so they were coming up as false positives, unfortunately that does not appear to have propagated over to the Save feature. This PR normalizes those serialization settings, so that should not happen anymore.

NullValueHandling = NullValueHandling.Ignore,
DateFormatHandling = DateFormatHandling.IsoDateFormat,
DateParseHandling = DateParseHandling.DateTimeOffset,
DateTimeZoneHandling = DateTimeZoneHandling.Utc,

Choose a reason for hiding this comment

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

is this the main thing that forces it to UTC as where before it was using the user's local TZ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Redis OM converts all DateTime's to epochs for storage - this makes them queryable in an index. Previously, they were not being properly converted in the Update method - the Update method handles 1 or many individual updates to documents tracked (or untracked) by the RedisCollection - I fixed that issue in the previous PR mentioned above. There is another route (Save) for which we were still not managing this properly (hence the fix).

@slorello89 slorello89 merged commit 40ffa00 into main Apr 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DateTimeOffset property changed offset after SaveAsync
2 participants