Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Period.Between can report partially-negative values #824
This isn't meant to happen...
Reported on http://stackoverflow.com/questions/44087757
var start = DateTime.Now; var end = start.AddDays(7).AddMinutes(-1); var period = Period.Between(LocalDateTime.FromDateTime(start), LocalDateTime.FromDateTime(end)); Console.WriteLine(period); // P6DT24H-1M
More investigation required.
Even a simple example is broken in 2.0:
var start = new LocalDateTime(2017, 5, 20, 18, 49, 30); var end = start.PlusDays(1).PlusMinutes(-30); var period = Period.Between(start, end); Console.WriteLine(period);
... but it works in 1.3. I think this is broken for every period which should have "23 hours and a bit".
It's worse than that - I think it's broken for all periods where the end time is later than the start time :( Definitely an urgent fix, and will require a 2.0.2 as soon as it is fixed. (The good news is it's quite a localized bug, but I need sleep before I can fix it, I think.)