You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-7Lines changed: 29 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,21 @@ Cron is a tool that allows you to execute _something_ on a schedule. This is typ
27
27
npm install cron
28
28
```
29
29
30
+
## Migrating from v2 to v3
31
+
32
+
In version 3 of this library, we aligned our format for the cron patterns with the UNIX format. See below for the changes you need to make when upgrading:
33
+
34
+
<details>
35
+
<summary>Migrating from v2 to v3</summary>
36
+
37
+
### Month & day-of-week indexing changes
38
+
39
+
**Month indexing went from `0-11` to `1-12`. So you need to increment all numeric months by 1.**
40
+
41
+
For day-of-week indexing, we only added support for `7` as Sunday, so you don't need to change anything !
42
+
43
+
</details>
44
+
30
45
## Versions and Backwards compatibility breaks
31
46
32
47
As goes with semver, breaking backwards compatibility should be explicit in the versioning of your library. As such, we'll upgrade the version of this module in accordance with breaking changes (We're not always great about doing it this way so if you notice that there are breaking changes that haven't been bumped appropriately please let us know).
@@ -65,14 +80,21 @@ There are tools that help when constructing your cronjobs. You might find someth
65
80
66
81
### Cron Ranges
67
82
68
-
When specifying your cron values you'll need to make sure that your values fall within the ranges. For instance, some cron's use a 0-7 range for the day of week where both 0 and 7 represent Sunday. We do not. And that is an optimisation.
83
+
This library follows the [UNIX Cron format](https://man7.org/linux/man-pages/man5/crontab.5.html), with an added field at the beginning for second granularity.
84
+
85
+
```
86
+
field allowed values
87
+
----- --------------
88
+
second 0-59
89
+
minute 0-59
90
+
hour 0-23
91
+
day of month 1-31
92
+
month 1-12 (or names, see below)
93
+
day of week 0-7 (0 or 7 is Sunday, or use names)
94
+
```
69
95
70
-
- Seconds: 0-59
71
-
- Minutes: 0-59
72
-
- Hours: 0-23
73
-
- Day of Month: 1-31
74
-
- Months: 0-11 (Jan-Dec) <-- currently different from Unix `cron`!
75
-
- Day of Week: 0-6 (Sun-Sat)
96
+
> Names can also be used for the 'month' and 'day of week' fields. Use the first three letters of the particular day or month (case does not matter). Ranges and lists of names are allowed.
0 commit comments