From f216797d4e6c01848541c7513fbec7777aaf8383 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 31 Aug 2021 20:02:54 +0200 Subject: [PATCH] Fix parsing dates on the last day of the month --- src/modules/parseTaskText.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/parseTaskText.test.js b/src/modules/parseTaskText.test.js index a3710df3..390b81d2 100644 --- a/src/modules/parseTaskText.test.js +++ b/src/modules/parseTaskText.test.js @@ -188,15 +188,15 @@ describe('Parse Task Text', () => { expect(result.date.getMonth()).toBe(date.getMonth() + 1) }) it('should recognize dates of the month in the future', () => { - const date = new Date() - const result = parseTaskText(`Lorem Ipsum ${date.getDate() + 1}nd`) + const nextDay = new Date(+new Date() + 60 * 60 * 24 * 1000) + const result = parseTaskText(`Lorem Ipsum ${nextDay.getDate()}nd`) expect(result.text).toBe('Lorem Ipsum') - expect(result.date.getDate()).toBe(date.getDate() + 1) + expect(result.date.getDate()).toBe(nextDay.getDate()) }) it('should only recognize weekdays with a space before or after them 1', () => { const result = parseTaskText('Lorem Ipsum renewed') - + expect(result.text).toBe('Lorem Ipsum renewed') expect(result.date).toBeNull() })