Open Fdawgs opened 3 weeks ago
Node version: 20.14.0 Compromise version: 14.13.0 Compromise-dates version: 3.5.0
Using the compromise-dates plugin, singular possessive dates are not projected correctly.
Example:
'use strict' /** @type {import('compromise').default} */ const nlp = require('compromise') const nlpDates = require('compromise-dates') nlp.plugin(nlpDates) const context = { today: '2023-01-01', } // Singular possessive example const doc1 = nlp("I'm leaving in a month's time") const datesViews1 = doc1.dates(context) const dateList1 = datesViews1.json() console.log(dateList1[0]?.dates) /** Output: { start: '2023-01-01T00:00:00.000Z', end: '2023-01-01T23:59:59.999Z', timezone: 'Europe/London', duration: { years: 0, months: 0, days: 1, hours: 0, minutes: 0 } } Expected: { start: '2023-02-01T00:00:00.000Z', end: '2023-02-01T23:59:59.999Z', timezone: 'Europe/London', duration: { years: 0, months: 0, days: 1, hours: 0, minutes: 0 } } */ // Plural possessive example (though it's incorrect grammar, it's a valid test case) const doc2 = nlp("I'm leaving in a months' time") const datesViews2 = doc2.dates(context) const dateList2 = datesViews2.json() console.log(dateList2[0]?.dates) /** Output: { start: '2023-02-01T00:00:00.000Z', end: '2023-02-01T23:59:59.999Z', timezone: 'Europe/London', duration: { years: 0, months: 0, days: 1, hours: 0, minutes: 0 } } */
Node version: 20.14.0 Compromise version: 14.13.0 Compromise-dates version: 3.5.0
Using the compromise-dates plugin, singular possessive dates are not projected correctly.
Example: