Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

NSDate.ToDateTime() appears to be bugged

$
0
0

I've made some modifications to the ExtendedDatePicker in the Xamarin.Forms.Labs control lib to support Date and Time. I'm getting some curious behaviour with NSDate.ToDateTime(). My value changed handler is as follows:

private void HandleValueChanged (object sender, EventArgs e)
{
Console.WriteLine (this.picker.Date.ToString());
base.Element.Date = this.picker.Date.ToDateTime ();
Console.WriteLine (base.Element.Date.ToString());
}

and it produces the following output:

2014-10-22 14:31:35.427 Surveillance[6347:761500] 2014-10-18 03:00:00 +0000
2014-10-22 14:31:35.428 Surveillance[6347:761500] 10/18/2014 12:00:00 AM
2014-10-22 14:31:41.158 Surveillance[6347:761500] 2014-10-18 04:00:00 +0000
2014-10-22 14:31:41.158 Surveillance[6347:761500] 10/18/2014 12:00:00 AM
2014-10-22 14:31:43.245 Surveillance[6347:761500] 2014-10-18 05:00:00 +0000
2014-10-22 14:31:43.245 Surveillance[6347:761500] 10/18/2014 12:00:00 AM
2014-10-22 14:31:44.162 Surveillance[6347:761500] 2014-10-18 06:00:00 +0000
2014-10-22 14:31:44.163 Surveillance[6347:761500] 10/18/2014 12:00:00 AM
2014-10-22 14:31:45.052 Surveillance[6347:761500] 2014-10-18 07:00:00 +0000
2014-10-22 14:31:45.053 Surveillance[6347:761500] 10/18/2014 12:00:00 AM

Notice that the time portion of the datetime is incorrect.

Can anyone confirm that they have seen this behaviour before I log a bug in bugzilla? Or have I missed something fundamental here?


Viewing all articles
Browse latest Browse all 58056

Trending Articles