Bug 60001 - [UWP] Inconsistency with DatePicker.
Summary: [UWP] Inconsistency with DatePicker.
Status: IN_PROGRESS
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-10-05 20:51 UTC by Brad Chase
Modified: 2017-10-10 20:18 UTC (History)
3 users (show)

See Also:
Tags: fr
Is this bug a regression?: ---
Last known good build:


Attachments
Differences... (15.43 KB, image/png)
2017-10-06 15:28 UTC, Brad Chase
Details
Android Difference... (650.91 KB, image/jpeg)
2017-10-06 15:29 UTC, Brad Chase
Details

Description Brad Chase 2017-10-05 20:51:32 UTC
The issue exists for us, where if you change the timezone of a DateTime, the value will show differently in Xamarin.Forms on UWP than Android and iOS.

The problem is with the DateTimeOffset which UWP is taking into account and the DatePicker is showing a different value to the users than what the other OS's currently show.
Comment 1 Brad Chase 2017-10-05 20:55:37 UTC
Link back to PR:

https://github.com/xamarin/Xamarin.Forms/pull/1183
Comment 2 Paul DiPietro [MSFT] 2017-10-05 21:25:41 UTC
I'll set this to in progress because there's a PR but can you better illustrate the scenario you're referring to here, and possibly add in a reproduction case for the gallery for visual confirmation?
Comment 3 Brad Chase 2017-10-05 23:42:59 UTC
Yea can do.  It's a weird case of natively it's correct... The problem is it's different than the other OS's which means we would have to make two separate properties to bind on with an idiom wherever we bind a datetime that has been set with a timezone change.  

Our silverlight app which runs the same code follows the standard xamarin has but with the new DateTimeOffset that UWP uses, it shows the wrong date.  We use alot of timezones(aviation industry) so I'm sure we see it more than others.
Comment 4 Brad Chase 2017-10-06 15:28:39 UTC
Created attachment 25174 [details]
Differences...

Here are some screenshots of the two differences... notice the date on the second row...  On iOS and Droid it shows on the 7th, correct.  But on UWP it shows as the 6th...  With the fix in, it shows correctly as the 7th.
Comment 5 Brad Chase 2017-10-06 15:29:14 UTC
Created attachment 25175 [details]
Android Difference...

Here are some screenshots of the two differences... notice the date on the second row...  On iOS and Droid it shows on the 7th, correct.  But on UWP it shows as the 6th...  With the fix in, it shows correctly as the 7th.
Comment 6 Brad Chase 2017-10-06 16:24:22 UTC
I checked in the test case.  The DatePickerRenderer code will need to be reverted to see the problem.

[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 60001, "[UWP] Inconsistency with DatePicker ", PlatformAffected.UWP)]
	public class Bugzilla60001 : TestContentPage // or TestMasterDetailPage, etc ...
	{
		protected override void Init()
		{
			StackLayout layout = new StackLayout() { Orientation = StackOrientation.Vertical };
			DatePicker picker = new DatePicker();
			picker.Date = new DateTime(2017, 10, 7, 0, 0, 0, DateTimeKind.Utc);
			Label label = new Label() { Text = "On Droid this will show as 10/7/2017, on UWP it will show as 10/06/2017.  Local TimeZone for this test was EDT.", LineBreakMode = LineBreakMode.WordWrap };
			layout.Children.Add(picker);
			layout.Children.Add(label);
			// Initialize ui here instead of ctor
			Content = layout;
		}
	}

Note You need to log in before you can comment on or make changes to this bug.