Noda Time: Period.Between() returning incorrect number of days?

Viewed 1408

Given the code snippet below, why are the final four output periods the same? I would expect the Days portion for those lines to be 4, 3, 2, 1 not 4, 4, 4, 4. Is this a bug or am I missing something obvious? (It's late and I'm tired, so it's very possibly the latter.) I'm using Noda Time 1.2.0.

for (int day = 25; day <= 31; day++)
{
    var d1 = new LocalDate(2013, 12, day);
    var d2 = new LocalDate(2015, 3, 4);

    var period = Period.Between(d1, d2);
    Debug.WriteLine("Day: {0}, Period: {1}", day, period);
}

// I get the following output:
Day: 25, Period: P1Y2M7D
Day: 26, Period: P1Y2M6D
Day: 27, Period: P1Y2M5D
Day: 28, Period: P1Y2M4D
Day: 29, Period: P1Y2M4D
Day: 30, Period: P1Y2M4D
Day: 31, Period: P1Y2M4D
1 Answers
Related