Skip to content

Commit e4b5610

Browse files
committed
reformat and fix errors in README
1 parent 571ddc9 commit e4b5610

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,41 +34,43 @@ npm install cron
3434

3535
1. [Features](#-features)
3636
2. [Installation](#-installation)
37-
3. [Migrating from v2 to v3](#-migrating-from-v2-to-v3)
37+
3. [Migrating](#-migrating)
3838
4. [Basic Usage](#-basic-usage)
39-
5. [Cron Patterns](#cron-patterns)
39+
5. [Cron Patterns](#-cron-patterns)
4040
- [Cron Syntax Overview](#cron-patterns)
4141
- [Supported Ranges](#supported-ranges)
42-
6. [Gotchas](#gotchas)
43-
7. [API](#api)
42+
6. [API](#-api)
4443
- [Standalone Functions](#standalone-functions)
4544
- [CronJob Class](#cronjob-class)
4645
- [CronTime Class](#crontime-class)
46+
7. [Gotchas](#-gotchas)
4747
8. [Community](#-community)
4848
- [Join the Community](#-community)
4949
9. [Contributing](#-contributing)
5050
- [General Contribution](#-contributing)
5151
- [Submitting Bugs/Issues](#-submitting-bugsissues)
5252
10. [Acknowledgements](#-acknowledgements)
53-
11. [License](#license)
53+
11. [License](#-license)
5454

55-
## 🔄 Migrating from v2 to v3
55+
## Migrating
5656

57-
With the introduction of TypeScript in version 3 and alignment with UNIX cron patterns, a few changes have been made:
57+
v4 dropped Node v16 and renamed the `job.running` property:
5858

5959
<details>
6060
<summary>Migrating from v3 to v4</summary>
6161

6262
### Dropped Node version
6363

64-
Node v16 is no longer supported. Upgrade your Node installation to Node v18 (LTS) or above
64+
Node v16 is no longer supported. Upgrade your Node installation to Node v18 or above
6565

6666
### Property renamed and now read-only
6767

6868
You can no longer set the `running` property (now `isActive`). It is read-only. To start or stop a cron job, use `job.start()` and `job.stop()`.
6969

7070
</details>
7171

72+
v3 introduced TypeScript and tighter Unix cron pattern alignment:
73+
7274
<details>
7375
<summary>Migrating from v2 to v3</summary>
7476

@@ -125,7 +127,7 @@ const job = CronJob.from({
125127
126128
For more advanced examples, check the [examples directory](https://github.com/kelektiv/node-cron/tree/main/examples).
127129

128-
## Cron Patterns
130+
## Cron Patterns
129131

130132
Cron patterns are the backbone of this library. Familiarize yourself with the syntax:
131133

@@ -155,13 +157,7 @@ day of week 0-7 (0 or 7 is Sunday, or use names)
155157
> 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.
156158
> Examples: "mon,wed,fri", "jan-mar".
157159
158-
## Gotchas
159-
160-
- Both JS `Date` and Luxon `DateTime` objects don't guarantee millisecond precision due to computation delays. This module excludes millisecond precision for standard cron syntax but allows execution date specification through JS `Date` or Luxon `DateTime` objects. However, specifying a precise future execution time, such as adding a millisecond to the current time, may not always work due to these computation delays. It's observed that delays less than 4-5 ms might lead to inconsistencies. While we could limit all date granularity to seconds, we've chosen to allow greater precision but advise users of potential issues.
161-
162-
- Using arrow functions for `onTick` binds them to the parent's `this` context. As a result, they won't have access to the cronjob's `this` context. You can read a little more in issue [#47 (comment)](https://github.com/kelektiv/node-cron/issues/47#issuecomment-459762775).
163-
164-
## API
160+
## 📖 API
165161

166162
### Standalone Functions
167163

@@ -262,6 +258,12 @@ day of week 0-7 (0 or 7 is Sunday, or use names)
262258

263259
- `utcOffset`: [OPTIONAL] - Analogous to `utcOffset` from `CronJob` parameters.
264260

261+
## 💢 Gotchas
262+
263+
- Both JS `Date` and Luxon `DateTime` objects don't guarantee millisecond precision due to computation delays. This module excludes millisecond precision for standard cron syntax but allows execution date specification through JS `Date` or Luxon `DateTime` objects. However, specifying a precise future execution time, such as adding a millisecond to the current time, may not always work due to these computation delays. It's observed that delays less than 4-5 ms might lead to inconsistencies. While we could limit all date granularity to seconds, we've chosen to allow greater precision but advise users of potential issues.
264+
265+
- Using arrow functions for `onTick` binds them to the parent's `this` context. As a result, they won't have access to the cronjob's `this` context. You can read a little more in issue [#47 (comment)](https://github.com/kelektiv/node-cron/issues/47#issuecomment-459762775).
266+
265267
## 🤝 Community
266268

267269
Join the [Discord server](https://discord.gg/yyKns29zch)! Here you can discuss issues and get help in a more casual forum than GitHub.
@@ -280,6 +282,6 @@ This is a community effort project. In the truest sense, this project started as
280282

281283
Special thanks to [Hiroki Horiuchi](https://github.com/horiuchi), [Lundarl Gholoi](https://github.com/winup) and [koooge](https://github.com/koooge) for their work on the [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) typings before they were imported in v2.4.0.
282284

283-
## License
285+
## License
284286

285287
MIT

0 commit comments

Comments
 (0)