Bug 26717 - NSDatePicker using YearMonthDateDay I would not expected SummerTime offsets.
Summary: NSDatePicker using YearMonthDateDay I would not expected SummerTime offsets.
Status: RESOLVED ANSWERED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.11.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2015-02-04 04:17 UTC by David Lilley
Modified: 2015-02-04 10:42 UTC (History)
2 users (show)

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


Attachments
Self Contained Test (13.04 KB, application/zip)
2015-02-04 04:18 UTC, David Lilley
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 ANSWERED

Description David Lilley 2015-02-04 04:17:50 UTC
When using NSDatePicker and only using the DatePart of it. I would have not expected the summer time offset to be issue.

NSDatePicker aDatePicker = new NSDatePicker(new CoreGraphics.CGRect(20, 20, 200, 40));
aDatePicker.DatePickerElements = NSDatePickerElementFlags.YearMonthDateDay;
aDatePicker.Activated += delegate 
{
System.DateTime aDate = (System.DateTime)aDatePicker.DateValue;
Debug.WriteLine(aDate.ToString());
};

Output Produced

2/1/2001 12:00:00 AM
3/1/2001 12:00:00 AM
3/31/2001 11:00:00 PM
2/1/2001 12:00:00 AM
3/1/2001 12:00:00 AM
3/31/2001 11:00:00 PM
4/30/2001 11:00:00 PM
5/31/2001 11:00:00 PM
4/30/2001 11:00:00 PM
5/31/2001 11:00:00 PM
6/30/2001 11:00:00 PM
7/31/2001 11:00:00 PM
6/30/2001 11:00:00 PM
7/31/2001 11:00:00 PM
8/31/2001 11:00:00 PM
9/30/2001 11:00:00 PM
8/31/2001 11:00:00 PM
9/30/2001 11:00:00 PM
11/1/2001 12:00:00 AM
12/1/2001 12:00:00 AM
11/1/2001 12:00:00 AM
12/1/2001 12:00:00 AM
1/1/2001 12:00:00 AM
1/1/2001 12:00:00 AM
(Note it also changes date and this is different to what is shown in the DatePicker..

Eg DatePicker Show 1/8/2001 whilst Debug Says 7/31/2001 11:00:00 PM

I cannot decide wether this is really a conversion to DateTime problem or Apple really wants us to set the TimeZone on this.

Using aDatePicker.TimeZone = new NSTimeZone("UTC") does change it to avoid BST
Comment 1 David Lilley 2015-02-04 04:18:14 UTC
Created attachment 9634 [details]
Self Contained Test
Comment 2 Udham Singh 2015-02-04 05:38:48 UTC
I have checked this issue with the help of sample app given in comment 1 and observed that on changing the date in DatePicker we are getting same date in application output (Debug.WriteLine). 

For every change in DatePicker we are getting time offset as '00:00:00' with date in application output, here I am not sure about the time offset part and I will need suggestion from the developer on the same.

Please refer the screencast : http://www.screencast.com/t/lgm9kR1lo

Could you please provide environment info, Ide log and Date & Time setting of your mac machine (Time Zone, Date & Time and Clock)? so that developer can figure out what's going on from provided info.

You can get environment info via 'Xamarin Studio > About xamarin Studio > Show Details > Copy Info and paste it here' and Ide log via 'Help > Open Log Directory and get the latest Ide Logs'.

Environment Info : 

=== Xamarin Studio ===

Version 5.7.1 (build 16)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.Mac ===

Version: 1.12.0.4 (Business Edition)

=== Build Information ===

Release ID: 507010016
Git revision: f12fcaf4707ab436bee2df6263eb5333197b262c
Build date: 2015-02-01 21:06:05-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 3 David Lilley 2015-02-04 05:41:46 UTC
=== Xamarin Studio ===

Version 5.7.1 (build 14)
Installation UUID: 974acce5-5296-4842-81d8-fad813eef863
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Xamarin.Android ===

Not Installed

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.iOS ===

Version: 8.6.1.20 (Business Edition)
Hash: 3b3ef43
Branch: 
Build date: 2015-01-24 09:42:21-0500

=== Xamarin.Mac ===

Version: 1.12.0.4 (Business Edition)

=== Build Information ===

Release ID: 507010014
Git revision: a4dd61ad7f8b3695be4b17bcb5c3ae6b81438cf7
Build date: 2015-01-19 15:21:09-05
Xamarin addins: 081208fe3bbf40e24a562867c6c7fba20a9b94b6

=== Operating System ===

Mac OS X 10.10.2
Darwin Davids-iMac.local 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 4 David Lilley 2015-02-04 05:44:26 UTC
Time Zone  Central European Standard Time
Comment 5 Chris Hamons 2015-02-04 10:42:54 UTC
I looked over our code for DateTime, and we're calling into the description selector when you ToString.

When you create there DateTime from the NSDate, we assume UTC.

Depending on your C# Local settings and your Cocoa Local settings, there could be some confusion on time zones. I believe explicitly setting the time zone explicitly is the correct thing to do here.