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

[Bug]: ForcedDateTimeKind not working #933

Open
markuspalme opened this issue May 28, 2024 · 3 comments
Open

[Bug]: ForcedDateTimeKind not working #933

markuspalme opened this issue May 28, 2024 · 3 comments
Labels

Comments

@markuspalme
Copy link

Describe the bug 🐞

When reading back a DateTimewith kind Unspecified and ForcedDateTimeKind = DateTimeKind.Unspecified, the resulting date has kind Utc and has has been converted to UTC which is unexpected.

Step to reproduce

Run this code:

using Akavache;
using System.Reactive.Linq;

BlobCache.ForcedDateTimeKind = DateTimeKind.Unspecified;
BlobCache.ApplicationName = "myapp";
BlobCache.EnsureInitialized();

var testDate = new DateTime(2024, 10, 10, 10, 10, 0, 0, DateTimeKind.Unspecified);

await BlobCache.LocalMachine.InsertObject("test", testDate);

var readBack = await BlobCache.LocalMachine.GetObject<DateTime>("test");

Console.WriteLine(testDate.ToLongTimeString() + ", " + testDate.Kind);
Console.WriteLine(readBack.ToLongTimeString() + ", " + readBack.Kind);

Reproduction repository

https://github.com/reactiveui/ReactiveUI

Expected behavior

The date that is read from the cache should be the same (same value and kind) as the one that is inserted.

Screenshots 🖼️

image

IDE

No response

Operating system

MacOS, iOS

Version

10.0.1

Device

No response

ReactiveUI Version

No response

Additional information ℹ️

No response

@markuspalme
Copy link
Author

Verified the behaviour on MacOS and iOS (net8-ios TFM).

@markuspalme
Copy link
Author

Maybe this has the same cause as #787.

I could work on a fix, but would like to have confirmation that the current behavior is indeed not the expected one first.

@corne-ac
Copy link

Currently having this issue, we get a json from an API, convert into an object, and store that in this dataservice. The received date is ex 10:36:40, and the second time we get the data, it gets retrieved from the BlobCache, it gets returned as 08:36:40. Tried all the various ForcedDateTimeKind settings.

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

No branches or pull requests

2 participants