conradludgate / interim

English date parser. Fork of chrono-english
MIT License
5 stars 2 forks source link

Proper handling of next week and this X #8

Open xeruf opened 3 months ago

xeruf commented 3 months ago

We should handle next according to dialect. Saying (in )1 week and next week produces the same result in parse_datetime, but most tools and humans would understand it differently: next week in task managers for example is typically interpreted as the beginning of next week, which should be equivalent to Monday then (or Sunday in some places).

Also, if today on a Thursday I write next Thursday, it selects the Thursday in a fortnight (Uk Dialect if that matters), which is odd in my opinion.

xeruf commented 3 months ago

And I just realized that unlike its predecessor, interim can handle this monday - but I would interpret that as the monday in this week, which today would be the 12.8., but it produces the coming Monday 19.8.

xeruf commented 3 months ago

According to chatgpt:

The phrase "this Monday" can have slightly different interpretations based on the context of the current day of the week when you say it. Here is a detailed explanation:

1. **Early in the Week (Sunday or Saturday):**
   - If today is **Saturday** or **Sunday**, "this Monday" usually refers to the upcoming Monday.

   For example, if today is Sunday, October 8, 2023, and you say "this Monday," it typically means Monday, October 9, 2023.

2. **On Monday Itself:**
   - If today is **Monday**, "this Monday" usually refers to the current day.

   For example, if today is Monday, October 9, 2023, and you say "this Monday," it means the current day, October 9, 2023.

3. **Later in the Week (Tuesday to Friday):**
   - If today is **Tuesday**, **Wednesday**, **Thursday**, or **Friday**, "this Monday" usually refers to the Monday that has just passed, earlier in the same week.

   For example, if today is Wednesday, October 11, 2023, and you say "this Monday," it typically means Monday, October 9, 2023.

To summarize:

- **Sunday or Saturday**: "This Monday" refers to the upcoming Monday.
- **Monday**: "This Monday" refers to the current day.
- **Tuesday to Friday**: "This Monday" refers to the Monday earlier in the same week.

The context in which the phrase is used can often clarify its meaning, but these are the general conventions.

What is definitely wrong is that this thursday today on a thursday is interpreted as the coming thursday.

xeruf commented 3 months ago

and how about adding previous DAY for the one before the last one? Today on a Monday I wanted to refer to the Sunday 8 days ago, which I would intuitively name previous Sunday as in the one before last Sunday.