Skip to content

[Bug]: ForcedDateTimeKind not working #933

Open
@markuspalme

Description

@markuspalme

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions