Skip to content

Commit

Permalink
Fix some problems
Browse files Browse the repository at this point in the history
  • Loading branch information
memwey committed Sep 4, 2022
1 parent 921be54 commit 02579b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cronrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func (cr *CronRange) CronExpression() string {
return cr.cronExpression
}

func new(cronExpr, timeZone string, duration time.Duration, cp cron.Parser) (cr *CronRange, err error) {
func new(cronExpr, timeZone string, dur time.Duration, cp cron.Parser) (cr *CronRange, err error) {
// Precondition check
if duration <= 0 {
if dur <= 0 {
err = errZeroDuration
return
}
Expand All @@ -89,7 +89,7 @@ func new(cronExpr, timeZone string, duration time.Duration, cp cron.Parser) (cr
cr = &CronRange{
cronExpression: cronExpr,
timeZone: timeZone,
duration: duration,
duration: dur,
schedule: schedule,
}
return
Expand Down
5 changes: 2 additions & 3 deletions serialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ PL:
if durMin, err = strconv.ParseUint(durStr, 10, 64); err != nil {
if version != Version2 {
break PL
} else {
err = nil
}
err = nil
}
case strings.HasPrefix(part, strMarkTimeZone):
timeZone = part[len(strMarkTimeZone):]
Expand All @@ -121,7 +120,7 @@ PL:
}

func ParseStringWithCronParser(s string, cp cron.Parser) (cr *CronRange, err error) {
cr, err = parseString(s, cronParser)
cr, err = parseString(s, cp)
return
}

Expand Down

0 comments on commit 02579b8

Please sign in to comment.