Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compromise-dates plugin: Does not project singular possessive dates #1117

Open
Fdawgs opened this issue Jun 13, 2024 · 0 comments
Open

Compromise-dates plugin: Does not project singular possessive dates #1117

Fdawgs opened this issue Jun 13, 2024 · 0 comments

Comments

@Fdawgs
Copy link
Contributor

Fdawgs commented Jun 13, 2024

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 }
}
*/
@Fdawgs Fdawgs changed the title Compromise-dates plugin does not detect singular possessive dates Compromise-dates plugin does not project singular possessive dates Jun 13, 2024
@Fdawgs Fdawgs changed the title Compromise-dates plugin does not project singular possessive dates Compromise-dates plugin: Does not project singular possessive dates Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants