facebook / duckling

Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Other
4.05k stars 719 forks source link

Inconsistent date range parsing #737

Closed aphilas closed 2 months ago

aphilas commented 2 months ago

Works as expected

from 2025 for two years

"to": { "value": "2028-01-01T00:00:00.000+00:00", "grain": "year" }, "from": { "value": "2025-01-01T00:00:00.000+00:00", "grain": "year" }

Bugs?

between 2025 and 2027

! should include 2027

"to": { "value": "2028-01-01T00:00:00.000+00:00", "grain": "year" }, "from": { "value": "2025-01-01T00:00:00.000+00:00", "grain": "year" }


2025 to 2027

! should include 2027

"to": { "value": "2028-01-01T00:00:00.000+00:00", "grain": "year" }, "from": { "value": "2025-01-01T00:00:00.000+00:00", "grain": "year" }


from 2025 to 2027

! no end date

"from": { "value": "2025-01-01T00:00:00.000+00:00", "grain": "year" }


Bonus, with grain month : )

from April to July

! should last through July

"to": { "value": "2024-08-01T00:00:00.000+00:00", "grain": "month" }, "from": { "value": "2024-04-01T00:00:00.000+00:00", "grain": "month" }

NOTE: In all cases, I am assuming duckling uses exclusive upper bound, and the upper bound is always incremented by one grain

aphilas commented 2 months ago

Closing until I have a better description/manual steps

Might have to create multiple issues