Bug 3389 - UIDatePicker Date property is always low by one day or one hour
Summary: UIDatePicker Date property is always low by one day or one hour
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-02-10 15:39 UTC by guivho
Modified: 2012-02-10 16:15 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

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:

Description guivho 2012-02-10 15:39:21 UTC
The DatePicker has a Date property, but its value is always low by 1 day.

When you select e.g. 2012-01-01 it has value 2011-12-31.

The value displayed on the picker is correct, but the Date Property is wrong.

This can easily be demonstrated with this little project.

Whenever the DatePicker is changed, the current Date value is written to the console.

The little demo at https://github.com/guivho/DatePickerTest only demonstrates the problem for UIDatePickerMode.Date cases.

But the two other modes can also be tested by fiddling with the comments on the mode lines.

UIDatePickerMode.DateAndTime and UIDatePickerMode.Time pickers have the hour field low by one hour.

I detected this problem with the latest 5.2.x MT, but it may well be inherited from previous versions.
Comment 1 guivho 2012-02-10 16:15:51 UTC
As Jackson Harper pointed out in the monotouch mailing list, this Date property is in UTC.

My local time is UTC+1, so the reported date is midnight - 1 hour, ergo the previous day.

Sorry for the noise.