Bug 60001 - [UWP] Inconsistency with DatePicker.
Summary: [UWP] Inconsistency with DatePicker.
Status: RESOLVED FIXED
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: 2018-01-31 18:20 UTC (History)
4 users (show)

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


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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;
		}
	}
Comment 7 Rui Marinho 2018-01-31 18:20:45 UTC
Should  be fixed on 2.6.0-pre1