fix: don't try to parse date numbers with letters around them
This commit is contained in:
parent
b3697cb9bf
commit
931941359b
2 changed files with 8 additions and 2 deletions
|
@ -288,7 +288,7 @@ const getDateFromWeekday = (text: string): dateFoundResult => {
|
|||
}
|
||||
|
||||
const getDayFromText = (text: string) => {
|
||||
const matcher = /(([1-2][0-9])|(3[01])|(0?[1-9]))(st|nd|rd|th|\.)/ig
|
||||
const matcher = /($| )(([1-2][0-9])|(3[01])|(0?[1-9]))(st|nd|rd|th|\.)($| )/ig
|
||||
const results = matcher.exec(text)
|
||||
if (results === null) {
|
||||
return {
|
||||
|
|
|
@ -32,7 +32,7 @@ describe('Parse Task Text', () => {
|
|||
expect(result.assignees).toHaveLength(1)
|
||||
expect(result.assignees[0]).toBe('user')
|
||||
})
|
||||
|
||||
|
||||
it('should ignore email addresses', () => {
|
||||
const text = 'Lorem Ipsum email@example.com'
|
||||
const result = parseTaskText(text)
|
||||
|
@ -242,6 +242,12 @@ describe('Parse Task Text', () => {
|
|||
expect(result.text).toBe('Lorem Ipsum github')
|
||||
expect(result.date).toBeNull()
|
||||
})
|
||||
it('should not recognize date number with no spacing around them', () => {
|
||||
const result = parseTaskText('Lorem Ispum v1.1.1')
|
||||
|
||||
expect(result.text).toBe('Lorem Ispum v1.1.1')
|
||||
expect(result.date).toBeNull()
|
||||
})
|
||||
|
||||
describe('Parse weekdays', () => {
|
||||
|
||||
|
|
Loading…
Reference in a new issue