From 918cecdd28da706586f2d409e88efe7255f07eec Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Fri, 5 Jun 2020 19:09:05 +0200 Subject: [PATCH] RelativeTime test fails on last day of the month (#719) --- test/datetime/relative.test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/datetime/relative.test.js b/test/datetime/relative.test.js index 2bccc5fc2..da4b8ef76 100644 --- a/test/datetime/relative.test.js +++ b/test/datetime/relative.test.js @@ -107,11 +107,11 @@ test("DateTime#toRelativeCalendar uses the calendar", () => { }); test("DateTime#toRelativeCalendar picks the correct unit with no options", () => { - expect( - DateTime.local() - .plus({ days: 1 }) - .toRelativeCalendar() - ).toBe("tomorrow"); + const now = DateTime.local(); + const isLastDayOfMonth = now.endOf("month").day === now.day; + expect(now.plus({ days: 1 }).toRelativeCalendar()).toBe( + isLastDayOfMonth ? "next month" : "tomorrow" + ); }); test("DateTime#toRelativeCalendar returns null when used on an invalid date", () => {