Commit Graph

110 Commits

Author SHA1 Message Date
Thomas Orozco
0373391ef0 Update import paths to krallin/cronexpr
This fork is to support Supercronic, and that's how it's imported there.
2020-11-14 14:51:02 +00:00
Thomas Orozco
cff9279a98 Reject intervals that are out of order
If an interval if out of order, it ends up emitting 0000-00-00 00:00:00
as the "next" time, which is undesirable. This patch updates Parse to
simply reject such intervals.

Since the rejection reason might not be super obvious (the range 6-7 is
actually translated to 6-0, which makes it invalid), let's also print
the original vs. normalized form for clarity.

See: https://github.com/aptible/supercronic/issues/63
2020-11-14 14:36:16 +00:00
Thomas Orozco
ee361fc97a Set up go modules 2020-11-14 14:18:03 +00:00
Thomas Orozco
b648cc9a90 Expose ParseStrict to error on too many fields
Parse currently ignores any tokens after the 7th, which means invalid
cron expressions might be allowed as long as invalid tokens are found
after the 7th character.

In some use cases (e.g. validating cron expressions provided by a user),
this might not be desirable. To allow for this use case, this adds a
ParseStrict function that returns an error if too many fields are
provided (it retains backwards compatibility by not touching Parse).
2018-08-01 16:10:17 +02:00
Raymond Hill
88b0669f7d Merge pull request #30 from dadgar/b-concurrent
Allow library to be used in parallel
2018-04-27 06:00:37 -04:00
Alex Dadgar
675cac9b2d Allow library to be used in parallel
This PR allows concurrent calls to Parse. Further it makes the test be
part of the same package.

Fixes https://github.com/gorhill/cronexpr/issues/26
2017-09-15 11:30:32 -07:00
Raymond Hill
d520615e53 Merge pull request #22 from aiquestion/intervalissue
fix infinite loop on err interval
2016-12-05 09:13:22 -05:00
xiaofan
86090e60c2 fix 60 interval issue 2016-12-05 11:16:12 +08:00
Raymond Hill
f0984319b4 Merge pull request #11 from takumakanari/support-numeric-format-starts-with-0
support 0N format for numeric field
2016-03-18 08:17:24 -04:00
takumakanari
cfcb638156 modify regex 2016-03-18 16:23:09 +09:00
takumakanari
334aab8a03 support 0N format for numeric field 2016-03-17 17:57:02 +09:00
gorhill
a557574d6c fixed regex, put back code block where it was 1.0.0 2014-04-23 19:13:48 -04:00
Raymond Hill
815886d9f2 Merge pull request #7 from safx/fix-parser
fixed parsering bug for like "*/5"
2014-04-23 19:11:08 -04:00
Safx
b0d44377d8 fixed parsering bug for like "*/5" 2014-04-23 01:22:28 +09:00
gorhill
f2ed51895e copies of available licenses 2013-11-20 06:15:47 -05:00
gorhill
0ef34dac9b now also aplv2 2013-11-20 06:10:35 -05:00
gorhill
28ed967826 trivial doc fix 2013-09-26 11:42:53 -04:00
gorhill
e1010b5ee1 added test 2013-09-11 19:37:42 -04:00
gorhill
8c982ee625 oops, fixed bug introduced by last change, added test case 2013-09-11 11:24:07 -04:00
gorhill
09aefb5f32 use precalculated dow offsets 2013-09-11 11:18:45 -04:00
gorhill
0e96f12377 #6: added simple test to avoid work 2013-09-10 16:09:51 -04:00
gorhill
2fc5c1e285 tab 2013-09-09 09:30:44 -04:00
gorhill
4a303f4d72 name 2013-09-09 09:30:28 -04:00
gorhill
ec79af33a8 moving command line utility here 2013-09-09 09:02:32 -04:00
gorhill
2323c4aca0 oops 2013-09-09 08:58:09 -04:00
gorhill
0766840399 moving command line utility here 2013-09-09 08:48:39 -04:00
gorhill
b4282cae90 LW 2013-09-08 10:40:27 -04:00
gorhill
17ea23bf08 further tidying 2013-09-08 10:37:12 -04:00
gorhill
13ba1270e1 split/rename 2013-09-07 17:11:53 -04:00
gorhill
8da0efdd84 split/rename cronexpr_impl.go 2013-09-07 17:08:27 -04:00
gorhill
8a4a15a5a2 restrict week number to valid values 2013-09-07 16:04:25 -04:00
gorhill
7f9a918f89 golint/deadcode/etc. 2013-09-07 15:45:21 -04:00
gorhill
e869d999cf issues #1, #3, #5, #6 2013-09-07 14:02:17 -04:00
gorhill
662c567db4 fixed borken example 2013-09-02 16:03:21 -04:00
gorhill
164843d2d0 added benchmarking, as per #5 2013-09-02 10:34:47 -04:00
gorhill
5442b2bfef changes as per #5 2013-09-02 09:25:49 -04:00
gorhill
4f0ef12848 clarification about time zones 2013-09-02 08:39:19 -04:00
gorhill
ed7ab26608 added test for specific weekdays of week 2013-09-02 08:05:09 -04:00
gorhill
b353b8f1d8 fixed specific weekdays of week, wasn't working 2013-09-02 08:02:14 -04:00
gorhill
718fc4c0ab changes as suggested at https://groups.google.com/d/msg/golang-nuts/la6mB5xG1L4/5V0L2GqF_1oJ 2013-09-01 09:24:01 -04:00
gorhill
1998268a1c go fmt'ed 2013-08-31 15:05:03 -04:00
gorhill
dc9d12775f reference to companion command-line utility 2013-08-31 14:57:24 -04:00
gorhill
68fd2b282b fixed time zone bug 2013-08-31 13:08:04 -04:00
gorhill
5c3ec34a8d fleshing out doc 2013-08-31 09:07:23 -04:00
gorhill
2594aadb14 fleshing out doc 2013-08-31 09:05:45 -04:00
gorhill
022ba1e5bf renaming cronexpression to cronexpr 2013-08-31 09:00:46 -04:00
gorhill
83135b3c5c renaming cronexpression to cronexpr 2013-08-31 09:00:12 -04:00
Raymond Hill
a7091b7c64 Rename cronexpression_test.go to cronexpr_test.go 2013-08-31 08:51:11 -04:00
Raymond Hill
6190b9d9db Rename cronexpression.go to cronexpr.go 2013-08-31 08:50:51 -04:00
gorhill
457a81697e code typo 2013-08-31 08:24:52 -04:00