Closed maxmin88 closed 5 years ago
Yes, this is by design.
That wouldn’t be my preference. But thanks for the reply.
Robert Twickler
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: James Montemagno notifications@github.com Sent: Saturday, October 26, 2019 10:16:40 AM To: jamesmontemagno/SettingsPlugin SettingsPlugin@noreply.github.com Cc: maxmin88 twick10@hotmail.com; Author author@noreply.github.com Subject: Re: [jamesmontemagno/SettingsPlugin] Using a DateTime Type Results in a UTC Return. (#157)
Yes, this is by design.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/jamesmontemagno/SettingsPlugin/issues/157?email_source=notifications&email_token=ACHDKBDXA3PRMDDZDCBLZILQQRNNRA5CNFSM4JEWGUA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKKD2A#issuecomment-546611688, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACHDKBHSLFPPCELLEGNAFDLQQRNNRANCNFSM4JEWGUAQ.
When I save a local DateTime to a DateTime setting it always returns a UTC time. On all my retrievals of a DateTime Setting I have to add .ToLocalTime() to get my local time back
Bug Information
Version Number of Plugin: 3.1.1 Device Tested On: OnePlus 6T Simulator Tested On: Version of VS: 16.3.4 Version of Xamarin: Forms 4.2.0.815419 Versions of other things you are using:
Steps to reproduce the Behavior
Settings.LastDateRetrieval = DateTime.Now; var datetime = Settings.LastDateRetrieval; //returns UTC time
Expected Behavior
expect it to return the DateTime value I put in
Actual Behavior
returns UTC time
Code snippet
public static class Settings { private static Plugin.Settings.Abstractions.ISettings AppSettings => Plugin.Settings.CrossSettings.Current; public static DateTime LastDateRetrieval { get { return AppSettings.GetValueOrDefault(nameof(LastDateRetrieval), DateTime.MinValue); } set { AppSettings.AddOrUpdateValue(nameof(LastDateRetrieval), value); } } }
Settings.LastDateRetrieval = DateTime.Now; var datetime = Settings.LastDateRetrieval; //returns UTC time
Screenshots