summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzed2015 <30643812+zed2015@users.noreply.github.com>2021-03-30 21:37:41 +0800
committerMathieu Le Marec - Pasquet <kiorky@cryptelium.net>2021-04-07 21:18:16 +0200
commit5794d0ea33818c04c097d24e1aa8fea108582aa3 (patch)
tree663dc80c5d17274c3c0cea1bfd160db2acb6b3f5
parent299b154d72533e75310db460e053427d7dc6442b (diff)
downloadcroniter-5794d0ea33818c04c097d24e1aa8fea108582aa3.tar.gz
fix bug: bad case:0 6 30 3 *
when crontab day only one day, but last month not has the day, example crontab expression: 0 6 30 3 *
-rw-r--r--src/croniter/croniter.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/croniter/croniter.py b/src/croniter/croniter.py
index 45ccaf1..4d989b0 100644
--- a/src/croniter/croniter.py
+++ b/src/croniter/croniter.py
@@ -539,7 +539,9 @@ class croniter(object):
if c <= range_val:
candidate = c
break
-
+ if condidate > range_val:
+ # fix crontab "0 6 30 3 *" condidates only a element, then get_prev error return 2021-03-02 06:00:00,
+ return -x
return (candidate - x - range_val)
@staticmethod