facebook / facebook/duckling

Intervals with leap year dates return incorrect years

Open
#735 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
4.3k
Forks
740
PR merge metrics
No merged PRs in 30d

Description

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:

https://github.com/facebook/duckling/blob/7520daaeba28691cda8e1b5c3d946028a28fb64b/Duckling/Testing/Types.hs#L72-L76

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.

Contributor guide

Open the contributing guide

Research direction

Reproduce the interval cases using the reftime parameter or the reference-date setup in Duckling/Testing/Types.hs at lines 72-76, comparing February 4-February 29 with February 4-February 28 across languages. Trace how Duckling resolves the range and add regression coverage so the leap-year range starts in 2024 while plain February 29 remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.