jamesmontemagno / Xamarin.Plugins

Cross-platform Native API Access from Shared Code!
MIT License
1.3k stars 380 forks source link

DateTime Kind support in Settings #320

Closed rasmuschristensen closed 8 years ago

rasmuschristensen commented 8 years ago

Please take a moment to fill out the following (change to preview to check or place x in []) and remove all unused areas

This is a

Which plugin does this impact:

I persist the the datetime of HttpHeader Last-Modified from a httpclient request. I get the DateTime from the Response content, with a DateTime Kind of type Unspecified. As far as I can tell this should be ok. The issue is that the Settings plugin converts this to UTC. When I then use the date in a later request, with If-Modified-Since, I now have a DateTime with Kind UTC and incorrect time. I won't do a ToLocal... as I might have moved location. I went into the source of settings and can see how you convert it to UTC, so it explains I don't keep the unspecified, but that means the Settings plugin mutates my data?

A bug or a question :), shouldn't the plugin support DateTimer Kind?

Best regards

Version Number of Plugin: 2.1.0 Device Tested On: IOS 9.3.2 Simulator Tested On:

Expected Behavior

Don't change the datatime

Actual Behavior

converts to UTC

Steps to reproduce the Behavior

Persist a DateTime with DateTimeKind Unspecified

Feature Request:

Please fill in what you would like

jamesmontemagno commented 8 years ago

This comes from: https://github.com/jamesmontemagno/Xamarin.Plugins/pull/107 and is as designed.

You could save things as ticks and save your own kind out to re-import.

rasmuschristensen commented 8 years ago

Hi @jamesmontemagno Thanks, makes sense.