Writing the time and then the Timezone and then the date is not recognized. Only the date is.
For example, writing: 10:30 pst today results in only today being recognized as a date. The same happens if writing the full date (10:30 pst 10/10/2023)
Omitting the timezone, works.
Writing the date before the time, with or without the timezone, also works.
Version
"chrono-node": "^2.6.4"
How to reproduce
Call the following:
chrono.casual.parse('10:30 pst today')
Testing
I've wrote a bunch of tests with Jest to be sure of this, in case it helps, the results:
● Test expected parsing results › should parse "10:30 pst today" as a date
expect(received).toBe(expected) // Object.is equality
Expected: "at 10:30 pst today"
Received: "today"
})
expect(result.date).toBeInstanceOf(Date)
expect(result.parseResult.text).toBe('at 10:30 pst today')
^
})
test('should parse "10:30 pst today" as a date', () => {
● Test expected parsing results › should parse "10:30 pst today" as a date
expect(received).toBe(expected) // Object.is equality
Expected: "10:30 pst today"
Received: "today"
})
expect(result.date).toBeInstanceOf(Date)
expect(result.parseResult.text).toBe('10:30 pst today')
^
})
test('should parse "10:30 pst tomorrow" as a date', () => {
● Test expected parsing results › should parse "10:30 pst tomorrow" as a date
expect(received).toBe(expected) // Object.is equality
Expected: "10:30 pst tomorrow"
Received: "tomorrow"
})
expect(result.date).toBeInstanceOf(Date)
expect(result.parseResult.text).toBe('10:30 pst tomorrow')
^
})
test('should parse "10:30 pst 10/10/2023" as a date', () => {
● Test expected parsing results › should parse "10:30 pst 10/10/2023" as a date
expect(received).toBe(expected) // Object.is equality
Expected: "10:30 pst 10/10/2023"
Received: "10/10/2023"
})
expect(result.date).toBeInstanceOf(Date)
expect(result.parseResult.text).toBe('10:30 pst 10/10/2023')
^
})
test('should parse "10:30 pst tod" as a date', () => {
● Test expected parsing results › should parse "10:30 pst tod" as a date
expect(received).toBe(expected) // Object.is equality
Expected: "10:30 pst tod"
Received: "tod"
})
expect(result.date).toBeInstanceOf(Date)
expect(result.parseResult.text).toBe('10:30 pst tod')
^
})
test('should parse "10:30 pst tod" as a date with raw chrono', () => {
Issue
Writing the time and then the Timezone and then the date is not recognized. Only the date is.
For example, writing:
10:30 pst today
results in only today being recognized as a date. The same happens if writing the full date (10:30 pst 10/10/2023
)Omitting the timezone, works. Writing the date before the time, with or without the timezone, also works.
Version
"chrono-node": "^2.6.4"
How to reproduce
Call the following:
Testing
I've wrote a bunch of tests with
Jest
to be sure of this, in case it helps, the results: