Skip to content

Commit

Permalink
fix(plugins/dates): match ^in
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Aug 12, 2024
1 parent 2178719 commit 73f52c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions plugins/dates/src/api/parse/range/02-date-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ export default [
},

{
// 2 to 4 weeks
match: '[<min>#Value] to [<max>#Value] [<unit>(day|days|week|weeks|month|months|year|years)]',
desc: '2 to 4 weeks',
// in 2 to 4 weeks
match: '^in [<min>#Value] to [<max>#Value] [<unit>(day|days|week|weeks|month|months|year|years)]',
desc: 'in 2 to 4 weeks',
parse: (m, context) => {
const { min, max, unit } = m.groups()

Expand Down
2 changes: 1 addition & 1 deletion plugins/dates/tests/duration-range.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const context = {
test('duration-ranges', function (t) {
durArr.forEach(obj => {
obj.text.forEach(text => {
const doc = nlp(text)
const doc = nlp(`in ${text}`)
const duration = doc.dates(context).get()[0].duration
t.deepEqual(duration, obj.duration, text)
})
Expand Down

0 comments on commit 73f52c1

Please sign in to comment.