package handlers import "time" const dateLayout = "2006-01-02" // parseOptionalDate parses a "YYYY-MM-DD" string, treating nil/empty as no // value. Used for the optional date fields on car/reminder inputs. func parseOptionalDate(s *string) (*time.Time, error) { if s == nil || *s == "" { return nil, nil } t, err := time.Parse(dateLayout, *s) if err != nil { return nil, err } return &t, nil }