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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user