maven: calendar event querying (task 3)
Store: CalendarEvents(ctx, from, to) — filters caldav facts by key date prefix. IPC: full wiring through interface, server dispatch, and client. Router: ParseCalendarDate (сегодня/завтра), CalendarEventFormatter (RU reply). Voice: calendar detection before notes RAG in IntentQuery handler. Tests: store integration test, date parser tests, formatter tests. Co-Authored-By: opencode <opencode@anthropic.com>
This commit is contained in:
@@ -327,3 +327,17 @@ func parseDurationValue(s string) (string, bool) {
|
||||
}
|
||||
return strconv.Itoa(n) + unit, true
|
||||
}
|
||||
|
||||
// ParseCalendarDate detects RU calendar date words in text and returns the
|
||||
// resolved time (midnight UTC+0 for "сегодня"/"today", next day for "завтра"/"tomorrow").
|
||||
// Returns zero time + false if no match.
|
||||
func ParseCalendarDate(text string, now time.Time) (time.Time, bool) {
|
||||
lower := strings.ToLower(text)
|
||||
if strings.Contains(lower, "сегодня") || strings.Contains(lower, "today") {
|
||||
return now.Truncate(24 * time.Hour), true
|
||||
}
|
||||
if strings.Contains(lower, "завтра") || strings.Contains(lower, "tomorrow") {
|
||||
return now.Truncate(24 * time.Hour).Add(24 * time.Hour), true
|
||||
}
|
||||
return time.Time{}, false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user