-
Notifications
You must be signed in to change notification settings - Fork 653
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
fix(plugins/dates): validate days and months in mm/dd
format
#1129
Conversation
ci: update github actions
chore: export view types
chore(package): export misc types
Tests are failing because |
i like the idea of tightening up the date detection, but i wonder if some english documents ever have the day before the month but specifically without the year, as in |
just found an explicit description: https://www.grammarly.com/blog/how-to-write-dates/#:~:text=writing%20dates%20as%20numerals
|
@hchiam British dates aren't fully supported as stated in the readme. Example: const doc = nlp('I have to go to the hellhole that is London on 12/08, by which I mean August').dates().get();
console.log(doc);
/*
[{ start: '2024-12-08', end: '2024-12-08' }]
*/ I assume the |
hey thanks - yeah, let's tighten it up. ya, definitely the best outcome would be passing a config to compromise, on how best to handle ambiguous dates. |
for future readers, i'm assuming the readme that was mentioned earlier is
the readme for the date plugin:
https://www.npmjs.com/package/compromise-dates -> if i look at both
instances of "British", the 1st made me think it's already supported, but
the 2nd made me think it's a future feature (config as y'all been saying).
not sure if I'm reading it wrong, but maybe the table needs to be updated
|
good point Howard - ya, the blurriness in the docs really demonstrates the lack of clarity in the project. As Frasier mentioned, a lot of the date-parsing is done with spacetime, which does an ok job at british formats - and this compromise-dates plugin could simply pass these british-dates through - it's very doable, and would be a welcome PR. If I remember:
open to either of you, if you've got some spare cycles. I can put it on my list for the future, otherwise. |
feel free to put it in the to-do list, but i plan to sometime next week
investigate adding a dmy option to compromise-dates
|
At present, compromise-dates tags anything
2-digit/2-digit
as aDate
:This PR updates the compromise-dates plugin to perform some minor validation of days and months when provided in the
mm/dd
format, by ensuring the months are between 01-12 and the days are between 01-31.