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 detect "fortnight" as a date #1114

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

Compromise-dates plugin does not detect "fortnight" as a date #1114

Fdawgs opened this issue Jun 5, 2024 · 0 comments

Comments

@Fdawgs
Copy link
Contributor

Fdawgs commented Jun 5, 2024

Node version: 20.14.0
Compromise version: 14.13.0
Compromise-dates version: 3.5.0

Using the compromise-dates plugin, "fornight" is not detected as a date value.

There does seem to be code in place for it.

Example:

'use strict'

/** @type {import('compromise').default} */
const nlp = require('compromise')
const nlpDates = require('compromise-dates')
nlp.plugin(nlpDates)

const doc = nlp("Let's play Fortnite in a fortnight")

const context = {
  today: '2023-01-01',
}

const datesViews = doc.dates(context)
const dateList = datesViews.json()

console.log(dateList[0]?.dates)
/*
Prints "undefined".

Expected it to print:
{
  start: '2023-01-15T00:00:00.000Z',
  end: '2023-01-15T23:59:59.999Z',
  timezone: 'Europe/London',
  duration: { years: 0, months: 0, days: 1, hours: 0, minutes: 0 }
}
*/
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