facebook/duckling

Intervals with leap year dates return incorrect years

Opened this issue · 0 comments

This is a tricky issue that only showed up this year. In order to reproduce, you need to set up the reference date to something like refTime (2024, 2, 1, 4, 30, 0) (-3) in:

testContext :: Context
testContext = Context
{ locale = makeLocale EN Nothing
, referenceTime = refTime (2013, 2, 12, 4, 30, 0) (-2)
}

or using the reftime parameter in the POST request.

For example, the input February 4 - February 29 returns the interval from: 2023-02-04 00:00:00 -0300 to: 2024-02-29 00:00:00 -0300. Note how the starting date is in 2023 rather than in 2024.

If we change the input to February 4 - February 28, we get the interval from: 2024-02-04 00:00:00 -0300 to: 2024-02-29 00:00:00 -0300, which is correct.

The issue is also not present when using plain dates, ex. February 29 returns value: 2024-02-29 00:00:00 -0300

This issue is present in all languages that I've tried so far (EN, ES, DE), so it seems to be something related to how Duckling resolves dates.