From 81d018bca25a1170ea6ecb5b067556a8fb1c5a8f Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Thu, 8 Aug 2024 14:49:15 +0100 Subject: [PATCH] fix(plugins/dates): inclusive --- plugins/dates/src/api/parse/range/02-date-range.js | 2 +- plugins/dates/tests/duration-range.test.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/dates/src/api/parse/range/02-date-range.js b/plugins/dates/src/api/parse/range/02-date-range.js index 7df1825e2..5fad56e41 100644 --- a/plugins/dates/src/api/parse/range/02-date-range.js +++ b/plugins/dates/src/api/parse/range/02-date-range.js @@ -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, diff --git a/plugins/dates/tests/duration-range.test.js b/plugins/dates/tests/duration-range.test.js index 3d5882c42..a7d7dc993 100644 --- a/plugins/dates/tests/duration-range.test.js +++ b/plugins/dates/tests/duration-range.test.js @@ -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 }, }, ]