xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] TimeZoneInfo convert time is not updated correctly for Jordan Standard Time #15711

Closed saiganesh-sakthivel closed 1 year ago

saiganesh-sakthivel commented 1 year ago

Description

[Bug] TimeZoneInfo convert time is not updated correctly for Jordan Standard Time. It differ for the iOS and other platforms (Android, UWP). In android and UWP the TimeZoneInfo.ConvertTime() from UTC to Jordan returns +2 hrs but iOS returns +3hrs.

Code Snippet public MainPage() { InitializeComponent(); var newdate = new DateTime(2018, 03, 25, 09, 0, 0); UTCTime.Text = newdate.ToString(); var timeZone = TimeZoneInfo.FindSystemTimeZoneById(GetTimeZone()); var jordandate = TimeZoneInfo.ConvertTime(newdate, TimeZoneInfo.Utc, timeZone); JordanTime.Text = jordandate.ToString(); }

string GetTimeZone() { switch (Device.RuntimePlatform) { case Device.UWP: return "Jordan Standard Time"; default: return "Asia/Amman"; } }

Steps to Reproduce

  1. Run the sample.
  2. in android, iOS and UWP platforms.
  3. in android and UWP will returns time +2hrs from UTC but iOS will returns time +3hrs.

Expected Behavior

It should returns +3hrs as per the world time. https://www.timeanddate.com/time/zone/jordan

Actual Behavior

Android and UWP returns +2hrs

Basic Information

Environment

Show/Hide Visual Studio info ``` ```

Build Logs

Screenshots

UWP ScheduleXamarin UWP 3_13_2023 6_40_54 PM

iOS Simulator Screen Shot - iPhone 8 - 2023-03-13 at 12 55 26

Reproduction Link

ScheduleXamarin.zip

Workaround

jfversluis commented 1 year ago

I highly doubt this has something to do with Xamarin.Forms. Try to create a Xamarin.Android and UWP project without Forms and see if it has the same behavior. If it does, it might be something for the Xamarin.Android team or even the runtime team.