relative_time icon indicating copy to clipboard operation
relative_time copied to clipboard

Incorrect Calculation of relative time for tomorrow

Open im28 opened this issue 1 year ago • 0 comments

There is a bug when calculating the relative days in the future as shown by the test below. I think the time difference calculated is not normalised correctly

test('one day formats as tomorrow', () {
        DateTime now = DateTime.now();
        DateTime nextMidnight = DateTime(now.year, now.month, now.day + 1);
        Duration timeUntilNextMidnight = nextMidnight.difference(now);
        _testFormat(
            fromNow: (DateTime now) => now.add(timeUntilNextMidnight),
            matcher: 'tomorrow',
            timeUnits: [TimeUnit.day]);
});

im28 avatar Jul 11 '24 06:07 im28