Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseDatetime ¶
ParseDatetime parses a natural-language or structured datetime string and returns the result in UTC. The provided location is used when the input has no explicit timezone (e.g. "today", "14:30", "2006-01-02 15:04").
Resolution chain (first match wins):
- "" -> error
- "now" -> time.Now().UTC()
- "today" -> midnight today in loc, converted to UTC
- "yesterday" -> midnight yesterday in loc, converted to UTC
- "today HH:MM[:SS]" -> today at that time in loc, to UTC
- "yesterday HH:MM[:SS]" -> yesterday at that time in loc, to UTC
- "HH:MM" -> today at that time in loc, to UTC
- RFC3339 -> parsed, to UTC
- "2006-01-02T15:04" -> in loc, to UTC
10. "2006-01-02 15:04" -> in loc, to UTC 11. "2006-01-02T15:04:05" -> in loc, to UTC 12. "2006-01-02 15:04:05" -> in loc, to UTC 13. "2006-01-02" -> midnight in loc, to UTC 14. error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.