MCPcopy Index your code
hub / github.com/coder/coder / TimeParsed

Method TimeParsed

coderd/schedule/cron/cron.go:232–241  ·  view source on GitHub ↗

TimeParsed returns the parsed time.Time of the minute and hour fields. If the time cannot be represented in a valid time.Time, a zero time is returned.

()

Source from the content-addressed store, hash-verified

230// TimeParsed returns the parsed time.Time of the minute and hour fields. If the
231// time cannot be represented in a valid time.Time, a zero time is returned.
232func (s Schedule) TimeParsed() time.Time {
233 minute := strings.Fields(s.cronStr)[0]
234 hour := strings.Fields(s.cronStr)[1]
235 maybeTime := fmt.Sprintf("%s:%s", hour, minute)
236 t, err := time.ParseInLocation("15:4", maybeTime, s.sched.Location)
237 if err != nil {
238 return time.Time{}
239 }
240 return t
241}
242
243// Time returns a humanized form of the minute and hour fields.
244func (s Schedule) Time() string {

Callers 3

TestUserQuietHoursFunction · 0.80

Calls 1

FieldsMethod · 0.65

Tested by 1

TestUserQuietHoursFunction · 0.64