relative_time
relative_time copied to clipboard
Incorrect Calculation of relative time for tomorrow
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]);
});