Files
gems/opal-task/doc/time-date-parsing.md
joakim 94ed5a7daf Update TIME.md with implementation status and examples
- Mark all features as implemented 
- Add comprehensive examples for all date formats
- Document configuration options
- Add examples for time of day, period boundaries, and relative expressions
- Include chaining examples and use cases
2026-01-05 10:13:34 +01:00

78 lines
2.4 KiB
Markdown

# Time and date parsing
## Time formats
- mon, monday - sun, sunday
- 21jan, 30dec, Jan21, jan21 (all case variations)
- 2015-12-21 (ISO format)
- jan, january, feb, february, etc. - Sets to first of month (current year if future, next year if passed)
- now - current date and time
- today, tomorrow, yesterday - at time 00:00
- sod, eod - start/end of day at 00:00 / 23:59:59
- sow, eow - start/end of week (configurable via week_start_day, default Monday)
- som, eom - start/end of month at 00:00 / 23:59:59
- soy, eoy - start/end of year at 00:00 / 23:59:59
- later, someday - 2150-01-01 at time 00:00
### Time of day support
All date formats support time of day:
- mon:15:35 (HH:MM format)
- mon:1535 (HHMM format, 4 digits)
- 15:35 (just time = today at that time)
- tomorrow:0800, 21jan:1430, etc.
24-hour format. Uses ':' separator from attribute:value syntax.
## Duration formats
- 5sec, 5seconds, second
- 5min, 5minutes, minute
- 5hrs, 5hours, hour, hr
- 3d, 3days, day
- 2w, 2weeks, week
- 4m, 4months, month
- 1y, 1year, year
- daily, weekly, monthly (30 days), yearly
Duration as date offset: `due:2d` = 2 days from now
Recurrence period: `recur:1w` = every week
## Relative date expressions
Date attributes can reference other date attributes:
- Subtraction: `opal add Buy milk due:mon wait:due-1d`
- Addition: `opal add Task due:today until:due+1y`
- Chaining: `opal add Task due:mon scheduled:due-3d wait:scheduled-1d`
- Supported operations: + (add), - (subtract)
- Order dependency: Referenced attribute must be defined earlier in same command
- Supported base attributes: due, scheduled, wait, until, start, end, created, modified
## Configuration
- `week_start_day: monday` (or sunday) - Controls sow/eow behavior
- `default_due_time: ""` - Optional default time for due dates (HH:MM format)
## Examples
```bash
# Basic dates
opal add Task due:tomorrow
opal add Task due:mon
opal add Task due:21jan
opal add Task due:march
# Time of day
opal add Meeting due:mon:15:30
opal add Call due:tomorrow:0900
# Period boundaries
opal add Report due:eow
opal add Review due:som
# Durations as dates
opal add Task due:2w # 2 weeks from now
opal add Task scheduled:3d # 3 days from now
# Relative expressions
opal add Project due:eom wait:due-1w scheduled:due-2w
opal add Task due:mon:14:00 wait:due-2d:09:00
# Recurring with all features
opal add "Weekly review" due:mon:10:00 recur:1w until:eoy
```