Fix parsing dates on the last day of the month

This commit is contained in:
kolaente 2021-08-31 20:02:54 +02:00
parent 6a34262d41
commit f216797d4e
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -188,11 +188,11 @@ 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')