Phase 2: Add config support for week_start_day and default_due_time

- Add WeekStartDay and DefaultDueTime fields to Config struct
- Set defaults: week_start_day=monday, default_due_time=empty
- Add GetWeekStart() and GetDefaultDueTime() helper methods
- Update ParseDate() to use configured week start day
- All tests passing
This commit is contained in:
2026-01-05 09:55:33 +01:00
parent b37e2dfc39
commit 43bbefbc00
2 changed files with 32 additions and 5 deletions
+8 -2
View File
@@ -263,8 +263,14 @@ func (p *DateParser) nextWeekday(target time.Weekday) time.Time {
return time.Date(next.Year(), next.Month(), next.Day(), 0, 0, 0, 0, next.Location())
}
// ParseDate is the public API that uses default settings
// ParseDate is the public API that uses config settings
func ParseDate(s string) (time.Time, error) {
parser := NewDefaultDateParser()
cfg, err := GetConfig()
weekStart := time.Monday // default
if err == nil {
weekStart = cfg.GetWeekStart()
}
parser := NewDateParser(timeNow(), weekStart)
return parser.ParseDate(s)
}