Phase 1: Refactor DateParser structure

- Create DateParser struct with configurable base time and week start
- Add placeholder methods for new parsing features
- Implement time-of-day parsing foundation (splitDateTime, parseTimeOfDay)
- Maintain backward compatibility with existing ParseDate() function
- Update tests to use new DateParser API
- All 33 existing tests passing
This commit is contained in:
2026-01-05 09:54:58 +01:00
parent a68d701d14
commit b37e2dfc39
3 changed files with 256 additions and 19 deletions
+28
View File
@@ -0,0 +1,28 @@
# Time parsing
## Time formats
- mon, monday - sun, sunday
- 21jan, 30dec etc
- 2015-12-21
- jan, feb, etc. - Sets to first of month
- now, current date and time
- today, tomorrow, yesterday - at time 00:00
- sod, sow, som, soy - start of X at time 00:00
- eod, eow, eom, eoy - end of X at time 23:59
- later, someday - 2150-01-01 at time 00:00
All time formats should also support time of day, mon:15:35 and mon:1535. 24-hour format. Mind the ':', must be seperated from the attribute:value syntax.
## Duration formats
- 5sec, second, seconds
- 5min, minute, minutes
- 5hrs, hour, hours
- 3d[ays], 2w[eeks], 4m[onths], 1y[ear]. Singular if 1, plural >1
- daily, weekly, monthly (30days), yearly
There is indirect support for durations everywhere that a date value is expected.
No ordinal assumes 1 (hours = hrs = hour = 60min)
## Relative formats
One attribute can be relative to another:
`opal add Buy milk due:mon wait:due-1d`