Closed Sally-Xu closed 9 years ago
Fixed in 0.16.39.
The fix only fixed DateTime.Today. But there is new problem.
If I create a date with the following code:
var d = new DateTime(2015, 6, 29) // this is today's date, so it should be the same as d.Date
I tried to compare the dates using Datetime.Compare and got the following result:
DateTime.Compare(d.Date, d) ! = 0 // this is not expected
or
DateTime.Compare(d.Date, DateTime.Today) ! = 0
d.Ticks has different value than d.Date.Ticks.
var d1 = DateTime.Today; // Default Kind is 1 var d = new DateTime(2015, 6, 29) // Default Kind is 2
I think the default "Kind" should be set to 1 ("Local") for all constructors of DateTime except for the one which takes "Kind" as a input parameter.
From the latest build, this is what I get in Chrome.
Did you try DateTime.Compare(new DateTime(2015, 6, 29).Date, DateTime.Today)
Updated comment.
Strange, now I try it, got the same result as yours. But I definitely saw different result when I first updated Fayde library this evening. never mind then.
My current local time is 6/20/2015 10PM, Here is Fayde's DateTime.Today's output in the debug watch window:
Date: DateTime Day: 21 DayOfWeek: 0 DayOfYear: 170 Hour: 0 Kind: 2 Millisecond: 0 Minute: 0 Month: 6 Second: 0 Ticks: 1434844800000 TimeOfDay: (...) Year: (...) _InternalDate: Sat Jun 20 2015 20:00:00 GMT-0400 (US Eastern Daylight Time)
Notice the Day is 21 instead of 20.
Shouldn't the default Kind be Local instead of UTC?