Skip to content

Commit

Permalink
fix(plugins/dates): inclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Aug 8, 2024
1 parent 1351468 commit 81d018b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugins/dates/src/api/parse/range/02-date-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default [

const duration = unit.text('implicit')
start = start.applyShift({ [duration]: min.numbers().get()[0] })
end = end.applyShift({ [duration]: max.numbers().get()[0] }).applyShift({ day: -1 })
end = end.applyShift({ [duration]: max.numbers().get()[0] })

return {
start: start,
Expand Down
8 changes: 4 additions & 4 deletions plugins/dates/tests/duration-range.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import nlp from './_lib.js'
const durArr = [
{
text: ['2 to 4 days', '2-4 days', 'two to four days'],
duration: { years: 0, months: 0, days: 2, hours: 0, minutes: 0 },
duration: { years: 0, months: 0, days: 3, hours: 0, minutes: 0 },
},
{
text: ['1 to 2 weeks', '1-2 weeks', 'one to two weeks'],
duration: { years: 0, months: 0, days: 7, hours: 0, minutes: 0 },
duration: { years: 0, months: 0, days: 14, hours: 0, minutes: 0 },
},
{
text: ['1 to 5 months', '1-5 months', 'one to five months'],
duration: { years: 0, months: 4, days: 0, hours: 0, minutes: 0 },
duration: { years: 0, months: 5, days: 0, hours: 0, minutes: 0 },
},
{
text: ['2 to 4 years', '2-4 years', 'two to four years'],
duration: { years: 2, months: 0, days: 0, hours: 0, minutes: 0 },
duration: { years: 3, months: 0, days: 0, hours: 0, minutes: 0 },
},
]

Expand Down

0 comments on commit 81d018b

Please sign in to comment.