Repository: kelektiv/node-cron (ts)

Issue:
Job scheduled with setTime throws error instead of running
### Description

When I reschedule a job to a specific date using the `job.setTime(new CronTime(startDate))` function, the job throws an error at the scheduled time instead of executing.

### Expected Behavior

I expect the job to run at `startDate`.

### Actual Behavior

I'm getting the following error:

```
node_modules/cron/dist/time.js:93
                throw new Error('WARNING: Date in past. Will never be fired.');
                ^

Error: WARNING: Date in past. Will never be fired.
```

### Possible Fix

_No response_

### Steps to Reproduce

```
// create job with a default schedule
const job = new CronJob(
  '0 0 20 * * *',
  () => console.log('onTick')
)

// re-schedule for 5 seconds from now
const startDate = new Date(Date.now() + 5000)
job.setTime(new CronTime(startDate))
job.start()

console.log('current date:', new Date())
console.log('start date:', startDate)
```

### Context

This used to be working properly in earlier versions of the library.

### Your Environment

- **`cron` version**: 3.1.3
- **NodeJS version**: 20.8.1
- **Operating System and version**: macOS 14.0, Debian 10.13


Pull request:
fix: set runOnce when actual date is given to setTime
## Description

initially, set the internal variable `runOnce` correctly when passing an actual date to `setTime`. previously this was only done in the constructor.

since it is only used in [one place](https://github.com/kelektiv/node-cron/blob/24f31caf4dd180d834f4f3ead2576cb80de9a4b8/src/job.ts#L261) and as to limit this kind of error, I then removed the `runOnce` property completely (we now check directly if `this.cronTime` is a real date). we do not consider this a breaking change since it was not referenced in the API documentation).

## Related Issue

Fixes #739.

## Motivation and Context

Fixes an issue when after creating a job with a cron expression and using `setTime` with an actual date, the job attempts to run multiple times.

## How Has This Been Tested?

added test case provided by #739's OP.

## Screenshots (if appropriate):

## Types of changes

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:

- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
- [ ] If my change introduces a breaking change, I have added a `!` after the type/scope in the title (see the Conventional Commits standard).


Patch:
diff --git a/package-lock.json b/package-lock.json
index 6e95161..0a530d9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -746,12 +746,12 @@
 			}
 		},
 		"node_modules/@commitlint/config-validator": {
-			"version": "17.6.7",
-			"resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-17.6.7.tgz",
-			"integrity": "sha512-vJSncmnzwMvpr3lIcm0I8YVVDJTzyjy7NZAeXbTXy+MPUdAr9pKyyg7Tx/ebOQ9kqzE6O9WT6jg2164br5UdsQ==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-17.8.1.tgz",
+			"integrity": "sha512-UUgUC+sNiiMwkyiuIFR7JG2cfd9t/7MV8VB4TZ+q02ZFkHoduUS4tJGsCBWvBOGD9Btev6IecPMvlWUfJorkEA==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/types": "^17.4.4",
+				"@commitlint/types": "^17.8.1",
 				"ajv": "^8.11.0"
 			},
 			"engines": {
@@ -759,12 +759,12 @@
 			}
 		},
 		"node_modules/@commitlint/ensure": {
-			"version": "17.6.7",
-			"resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-17.6.7.tgz",
-			"integrity": "sha512-mfDJOd1/O/eIb/h4qwXzUxkmskXDL9vNPnZ4AKYKiZALz4vHzwMxBSYtyL2mUIDeU9DRSpEUins8SeKtFkYHSw==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-17.8.1.tgz",
+			"integrity": "sha512-xjafwKxid8s1K23NFpL8JNo6JnY/ysetKo8kegVM7c8vs+kWLP8VrQq+NbhgVlmCojhEDbzQKp4eRXSjVOGsow==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/types": "^17.4.4",
+				"@commitlint/types": "^17.8.1",
 				"lodash.camelcase": "^4.3.0",
 				"lodash.kebabcase": "^4.1.1",
 				"lodash.snakecase": "^4.1.1",
@@ -776,21 +776,21 @@
 			}
 		},
 		"node_modules/@commitlint/execute-rule": {
-			"version": "17.4.0",
-			"resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-17.4.0.tgz",
-			"integrity": "sha512-LIgYXuCSO5Gvtc0t9bebAMSwd68ewzmqLypqI2Kke1rqOqqDbMpYcYfoPfFlv9eyLIh4jocHWwCK5FS7z9icUA==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-17.8.1.tgz",
+			"integrity": "sha512-JHVupQeSdNI6xzA9SqMF+p/JjrHTcrJdI02PwesQIDCIGUrv04hicJgCcws5nzaoZbROapPs0s6zeVHoxpMwFQ==",
 			"dev": true,
 			"engines": {
 				"node": ">=v14"
 			}
 		},
 		"node_modules/@commitlint/format": {
-			"version": "17.4.4",
-			"resolved": "https://registry.npmjs.org/@commitlint/format/-/format-17.4.4.tgz",
-			"integrity": "sha512-+IS7vpC4Gd/x+uyQPTAt3hXs5NxnkqAZ3aqrHd5Bx/R9skyCAWusNlNbw3InDbAK6j166D9asQM8fnmYIa+CXQ==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/format/-/format-17.8.1.tgz",
+			"integrity": "sha512-f3oMTyZ84M9ht7fb93wbCKmWxO5/kKSbwuYvS867duVomoOsgrgljkGGIztmT/srZnaiGbaK8+Wf8Ik2tSr5eg==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/types": "^17.4.4",
+				"@commitlint/types": "^17.8.1",
 				"chalk": "^4.1.0"
 			},
 			"engines": {
@@ -798,12 +798,12 @@
 			}
 		},
 		"node_modules/@commitlint/is-ignored": {
-			"version": "17.8.0",
-			"resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-17.8.0.tgz",
-			"integrity": "sha512-8bR6rxNcWaNprPBdE4ePIOwbxutTQGOsRPYWssX+zjGxnEljzaZSGzFUOMxapYILlf8Tts/O1wPQgG549Rdvdg==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-17.8.1.tgz",
+			"integrity": "sha512-UshMi4Ltb4ZlNn4F7WtSEugFDZmctzFpmbqvpyxD3la510J+PLcnyhf9chs7EryaRFJMdAKwsEKfNK0jL/QM4g==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/types": "^17.4.4",
+				"@commitlint/types": "^17.8.1",
 				"semver": "7.5.4"
 			},
 			"engines": {
@@ -811,30 +811,30 @@
 			}
 		},
 		"node_modules/@commitlint/lint": {
-			"version": "17.8.0",
-			"resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-17.8.0.tgz",
-			"integrity": "sha512-4ihwnqOY4TcJN6iz5Jv1LeYavvBllONwFyGxOIWmCT5s4PNMb43cws2TUdbXTZL1Vq59etGKd5LWYDFPVbs5EA==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-17.8.1.tgz",
+			"integrity": "sha512-aQUlwIR1/VMv2D4GXSk7PfL5hIaFSfy6hSHV94O8Y27T5q+DlDEgd/cZ4KmVI+MWKzFfCTiTuWqjfRSfdRllCA==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/is-ignored": "^17.8.0",
-				"@commitlint/parse": "^17.7.0",
-				"@commitlint/rules": "^17.7.0",
-				"@commitlint/types": "^17.4.4"
+				"@commitlint/is-ignored": "^17.8.1",
+				"@commitlint/parse": "^17.8.1",
+				"@commitlint/rules": "^17.8.1",
+				"@commitlint/types": "^17.8.1"
 			},
 			"engines": {
 				"node": ">=v14"
 			}
 		},
 		"node_modules/@commitlint/load": {
-			"version": "17.8.0",
-			"resolved": "https://registry.npmjs.org/@commitlint/load/-/load-17.8.0.tgz",
-			"integrity": "sha512-9VnGXYJCP4tXmR4YrwP8n5oX6T5ZsHfPQq6WuUQOvAI+QsDQMaTGgTRXr7us+xsjz+b+mMBSagogqfUx2aixyw==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/load/-/load-17.8.1.tgz",
+			"integrity": "sha512-iF4CL7KDFstP1kpVUkT8K2Wl17h2yx9VaR1ztTc8vzByWWcbO/WaKwxsnCOqow9tVAlzPfo1ywk9m2oJ9ucMqA==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/config-validator": "^17.6.7",
-				"@commitlint/execute-rule": "^17.4.0",
-				"@commitlint/resolve-extends": "^17.6.7",
-				"@commitlint/types": "^17.4.4",
+				"@commitlint/config-validator": "^17.8.1",
+				"@commitlint/execute-rule": "^17.8.1",
+				"@commitlint/resolve-extends": "^17.8.1",
+				"@commitlint/types": "^17.8.1",
 				"@types/node": "20.5.1",
 				"chalk": "^4.1.0",
 				"cosmiconfig": "^8.0.0",
@@ -844,7 +844,7 @@
 				"lodash.uniq": "^4.5.0",
 				"resolve-from": "^5.0.0",
 				"ts-node": "^10.8.1",
-				"typescript": "^4.6.4 || ^5.0.0"
+				"typescript": "^4.6.4 || ^5.2.2"
 			},
 			"engines": {
 				"node": ">=v14"
@@ -857,21 +857,21 @@
 			"dev": true
 		},
 		"node_modules/@commitlint/message": {
-			"version": "17.4.2",
-			"resolved": "https://registry.npmjs.org/@commitlint/message/-/message-17.4.2.tgz",
-			"integrity": "sha512-3XMNbzB+3bhKA1hSAWPCQA3lNxR4zaeQAQcHj0Hx5sVdO6ryXtgUBGGv+1ZCLMgAPRixuc6en+iNAzZ4NzAa8Q==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/message/-/message-17.8.1.tgz",
+			"integrity": "sha512-6bYL1GUQsD6bLhTH3QQty8pVFoETfFQlMn2Nzmz3AOLqRVfNNtXBaSY0dhZ0dM6A2MEq4+2d7L/2LP8TjqGRkA==",
 			"dev": true,
 			"engines": {
 				"node": ">=v14"
 			}
 		},
 		"node_modules/@commitlint/parse": {
-			"version": "17.7.0",
-			"resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-17.7.0.tgz",
-			"integrity": "sha512-dIvFNUMCUHqq5Abv80mIEjLVfw8QNuA4DS7OWip4pcK/3h5wggmjVnlwGCDvDChkw2TjK1K6O+tAEV78oxjxag==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-17.8.1.tgz",
+			"integrity": "sha512-/wLUickTo0rNpQgWwLPavTm7WbwkZoBy3X8PpkUmlSmQJyWQTj0m6bDjiykMaDt41qcUbfeFfaCvXfiR4EGnfw==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/types": "^17.4.4",
+				"@commitlint/types": "^17.8.1",
 				"conventional-changelog-angular": "^6.0.0",
 				"conventional-commits-parser": "^4.0.0"
 			},
@@ -880,13 +880,13 @@
 			}
 		},
 		"node_modules/@commitlint/read": {
-			"version": "17.5.1",
-			"resolved": "https://registry.npmjs.org/@commitlint/read/-/read-17.5.1.tgz",
-			"integrity": "sha512-7IhfvEvB//p9aYW09YVclHbdf1u7g7QhxeYW9ZHSO8Huzp8Rz7m05aCO1mFG7G8M+7yfFnXB5xOmG18brqQIBg==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/read/-/read-17.8.1.tgz",
+			"integrity": "sha512-Fd55Oaz9irzBESPCdMd8vWWgxsW3OWR99wOntBDHgf9h7Y6OOHjWEdS9Xzen1GFndqgyoaFplQS5y7KZe0kO2w==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/top-level": "^17.4.0",
-				"@commitlint/types": "^17.4.4",
+				"@commitlint/top-level": "^17.8.1",
+				"@commitlint/types": "^17.8.1",
 				"fs-extra": "^11.0.0",
 				"git-raw-commits": "^2.0.11",
 				"minimist": "^1.2.6"
@@ -896,13 +896,13 @@
 			}
 		},
 		"node_modules/@commitlint/resolve-extends": {
-			"version": "17.6.7",
-			"resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-17.6.7.tgz",
-			"integrity": "sha512-PfeoAwLHtbOaC9bGn/FADN156CqkFz6ZKiVDMjuC2N5N0740Ke56rKU7Wxdwya8R8xzLK9vZzHgNbuGhaOVKIg==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-17.8.1.tgz",
+			"integrity": "sha512-W/ryRoQ0TSVXqJrx5SGkaYuAaE/BUontL1j1HsKckvM6e5ZaG0M9126zcwL6peKSuIetJi7E87PRQF8O86EW0Q==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/config-validator": "^17.6.7",
-				"@commitlint/types": "^17.4.4",
+				"@commitlint/config-validator": "^17.8.1",
+				"@commitlint/types": "^17.8.1",
 				"import-fresh": "^3.0.0",
 				"lodash.mergewith": "^4.6.2",
 				"resolve-from": "^5.0.0",
@@ -913,15 +913,15 @@
 			}
 		},
 		"node_modules/@commitlint/rules": {
-			"version": "17.7.0",
-			"resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-17.7.0.tgz",
-			"integrity": "sha512-J3qTh0+ilUE5folSaoK91ByOb8XeQjiGcdIdiB/8UT1/Rd1itKo0ju/eQVGyFzgTMYt8HrDJnGTmNWwcMR1rmA==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-17.8.1.tgz",
+			"integrity": "sha512-2b7OdVbN7MTAt9U0vKOYKCDsOvESVXxQmrvuVUZ0rGFMCrCPJWWP1GJ7f0lAypbDAhaGb8zqtdOr47192LBrIA==",
 			"dev": true,
 			"dependencies": {
-				"@commitlint/ensure": "^17.6.7",
-				"@commitlint/message": "^17.4.2",
-				"@commitlint/to-lines": "^17.4.0",
-				"@commitlint/types": "^17.4.4",
+				"@commitlint/ensure": "^17.8.1",
+				"@commitlint/message": "^17.8.1",
+				"@commitlint/to-lines": "^17.8.1",
+				"@commitlint/types": "^17.8.1",
 				"execa": "^5.0.0"
 			},
 			"engines": {
@@ -929,18 +929,18 @@
 			}
 		},
 		"node_modules/@commitlint/to-lines": {
-			"version": "17.4.0",
-			"resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-17.4.0.tgz",
-			"integrity": "sha512-LcIy/6ZZolsfwDUWfN1mJ+co09soSuNASfKEU5sCmgFCvX5iHwRYLiIuoqXzOVDYOy7E7IcHilr/KS0e5T+0Hg==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-17.8.1.tgz",
+			"integrity": "sha512-LE0jb8CuR/mj6xJyrIk8VLz03OEzXFgLdivBytoooKO5xLt5yalc8Ma5guTWobw998sbR3ogDd+2jed03CFmJA==",
 			"dev": true,
 			"engines": {
 				"node": ">=v14"
 			}
 		},
 		"node_modules/@commitlint/top-level": {
-			"version": "17.4.0",
-			"resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-17.4.0.tgz",
-			"integrity": "sha512-/1loE/g+dTTQgHnjoCy0AexKAEFyHsR2zRB4NWrZ6lZSMIxAhBJnmCqwao7b4H8888PsfoTBCLBYIw8vGnej8g==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-17.8.1.tgz",
+			"integrity": "sha512-l6+Z6rrNf5p333SHfEte6r+WkOxGlWK4bLuZKbtf/2TXRN+qhrvn1XE63VhD8Oe9oIHQ7F7W1nG2k/TJFhx2yA==",
 			"dev": true,
 			"dependencies": {
 				"find-up": "^5.0.0"
@@ -950,9 +950,9 @@
 			}
 		},
 		"node_modules/@commitlint/types": {
-			"version": "17.4.4",
-			"resolved": "https://registry.npmjs.org/@commitlint/types/-/types-17.4.4.tgz",
-			"integrity": "sha512-amRN8tRLYOsxRr6mTnGGGvB5EmW/4DDjLMgiwK3CCVEmN6Sr/6xePGEpWaspKkckILuUORCwe6VfDBw6uj4axQ==",
+			"version": "17.8.1",
+			"resolved": "https://registry.npmjs.org/@commitlint/types/-/types-17.8.1.tgz",
+			"integrity": "sha512-PXDQXkAmiMEG162Bqdh9ChML/GJZo6vU+7F03ALKDK8zYc6SuAr47LjG7hGYRqUOz+WK0dU7bQ0xzuqFMdxzeQ==",
 			"dev": true,
 			"dependencies": {
 				"chalk": "^4.1.0"
@@ -1062,12 +1062,12 @@
 			}
 		},
 		"node_modules/@humanwhocodes/config-array": {
-			"version": "0.11.11",
-			"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz",
-			"integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==",
+			"version": "0.11.13",
+			"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz",
+			"integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==",
 			"dev": true,
 			"dependencies": {
-				"@humanwhocodes/object-schema": "^1.2.1",
+				"@humanwhocodes/object-schema": "^2.0.1",
 				"debug": "^4.1.1",
 				"minimatch": "^3.0.5"
 			},
@@ -1089,9 +1089,9 @@
 			}
 		},
 		"node_modules/@humanwhocodes/object-schema": {
-			"version": "1.2.1",
-			"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
-			"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
+			"version": "2.0.1",
+			"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz",
+			"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
 			"dev": true
 		},
 		"node_modules/@insurgentlab/commitlint-config": {
@@ -1718,9 +1718,9 @@
 			}
 		},
 		"node_modules/@octokit/plugin-throttling": {
-			"version": "8.0.0",
-			"resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-8.0.0.tgz",
-			"integrity": "sha512-OkMbHYUidj81q92YRkPzWmwXkEtsI3KOcSkNm763aqUOh9IEplyX05XjKAdZFANAvaYH0Q4JBZwu4h2VnPVXZA==",
+			"version": "8.0.1",
+			"resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-8.0.1.tgz",
+			"integrity": "sha512-i373s7TgaoAOlzOepjUTvyMXqjBu9b26SvLyLD5onBdgexIOeu43yOH1e3z3VPAzbEyRfKDHcqfAsOyKl7Jtxg==",
 			"dev": true,
 			"dependencies": {
 				"@octokit/types": "^12.0.0",
@@ -3305,9 +3305,9 @@
 			}
 		},
 		"node_modules/caniuse-lite": {
-			"version": "1.0.30001550",
-			"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001550.tgz",
-			"integrity": "sha512-p82WjBYIypO0ukTsd/FG3Xxs+4tFeaY9pfT4amQL8KWtYH7H9nYwReGAbMTJ0hsmRO8IfDtsS6p3ZWj8+1c2RQ==",
+			"version": "1.0.30001553",
+			"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001553.tgz",
+			"integrity": "sha512-N0ttd6TrFfuqKNi+pMgWJTb9qrdJu4JSpgPFLe/lrD19ugC6fZgF0pUewRowDwzdDnb9V41mFcdlYgl/PyKf4A==",
 			"dev": true,
 			"funding": [
 				{
@@ -4303,9 +4303,9 @@
 			}
 		},
 		"node_modules/electron-to-chromium": {
-			"version": "1.4.558",
-			"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.558.tgz",
-			"integrity": "sha512-j9IcGmfkyN5MBH/0Xzg45GDHasXsnwEJDM6Xnr9H7GlGUni+JH4q6xp6Nk7NV5LjTmoEFBqhILIqg1McJrv6uA==",
+			"version": "1.4.563",
+			"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.563.tgz",
+			"integrity": "sha512-dg5gj5qOgfZNkPNeyKBZQAQitIQ/xwfIDmEQJHCbXaD9ebTZxwJXUsDYcBlAvZGZLi+/354l35J1wkmP6CqYaw==",
 			"dev": true
 		},
 		"node_modules/emittery": {
@@ -5179,6 +5179,15 @@
 				"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
 			}
 		},
+		"node_modules/function-bind": {
+			"version": "1.1.2",
+			"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+			"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+			"dev": true,
+			"funding": {
+				"url": "https://github.com/sponsors/ljharb"
+			}
+		},
 		"node_modules/gensync": {
 			"version": "1.0.0-beta.2",
 			"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
@@ -5642,15 +5651,6 @@
 				"node": ">=6"
 			}
 		},
-		"node_modules/has": {
-			"version": "1.0.4",
-			"resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz",
-			"integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==",
-			"dev": true,
-			"engines": {
-				"node": ">= 0.4.0"
-			}
-		},
 		"node_modules/has-flag": {
 			"version": "4.0.0",
 			"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -5660,6 +5660,18 @@
 				"node": ">=8"
 			}
 		},
+		"node_modules/hasown": {
+			"version": "2.0.0",
+			"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
+			"integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
+			"dev": true,
+			"dependencies": {
+				"function-bind": "^1.1.2"
+			},
+			"engines": {
+				"node": ">= 0.4"
+			}
+		},
 		"node_modules/hook-std": {
 			"version": "3.0.0",
 			"resolved": "https://registry.npmjs.org/hook-std/-/hook-std-3.0.0.tgz",
@@ -5877,12 +5889,12 @@
 			"dev": true
 		},
 		"node_modules/is-core-module": {
-			"version": "2.13.0",
-			"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz",
-			"integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==",
+			"version": "2.13.1",
+			"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
+			"integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
 			"dev": true,
 			"dependencies": {
-				"has": "^1.0.3"
+				"hasown": "^2.0.0"
 			},
 			"funding": {
 				"url": "https://github.com/sponsors/ljharb"
@@ -7376,9 +7388,9 @@
 			"dev": true
 		},
 		"node_modules/nise": {
-			"version": "5.1.4",
-			"resolved": "https://registry.npmjs.org/nise/-/nise-5.1.4.tgz",
-			"integrity": "sha512-8+Ib8rRJ4L0o3kfmyVCL7gzrohyDe0cMFTBa2d364yIrEGMEoetznKJx899YxjybU6bL9SQkYPSBBs1gyYs8Xg==",
+			"version": "5.1.5",
+			"resolved": "https://registry.npmjs.org/nise/-/nise-5.1.5.tgz",
+			"integrity": "sha512-VJuPIfUFaXNRzETTQEEItTOP8Y171ijr+JLq42wHes3DiryR8vT+1TXQW/Rx8JNUhyYYWyIvjXTU6dOhJcs9Nw==",
 			"dev": true,
 			"dependencies": {
 				"@sinonjs/commons": "^2.0.0",
diff --git a/src/job.ts b/src/job.ts
index 2937875..68d7c34 100644
--- a/src/job.ts
+++ b/src/job.ts
@@ -16,7 +16,6 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
 	running = false;
 	unrefTimeout = false;
 	lastExecution: Date | null = null;
-	runOnce = false;
 	context: CronContext<C>;
 	onComplete?: WithOnComplete<OC> extends true
 		? CronOnCompleteCallback
@@ -84,10 +83,6 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
 			) as WithOnComplete<OC> extends true ? CronOnCompleteCallback : undefined;
 		}
 
-		if (this.cronTime.realDate) {
-			this.runOnce = true;
-		}
-
 		this.addCallback(this._fnWrap(onTick));
 
 		if (runOnInit) {
@@ -181,7 +176,9 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
 		}
 		const wasRunning = this.running;
 		this.stop();
+
 		this.cronTime = time;
+
 		if (wasRunning) this.start();
 	}
 
@@ -258,7 +255,7 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
 				this.running = false;
 
 				// start before calling back so the callbacks have the ability to stop the cron job
-				if (!this.runOnce) {
+				if (!this.cronTime.realDate) {
 					this.start();
 				}
 
diff --git a/src/time.ts b/src/time.ts
index 126698a..17b6a0e 100644
--- a/src/time.ts
+++ b/src/time.ts
@@ -684,7 +684,7 @@ export class CronTime {
 		return true;
 	}
 
-	/*
+	/**
 	 * Parse the cron syntax into something useful for selecting the next execution time.
 	 *
 	 * Algorithm:
@@ -733,7 +733,7 @@ export class CronTime {
 		}
 	}
 
-	/*
+	/**
 	 * Parse individual field from the cron syntax provided.
 	 *
 	 * Algorithm:


Test patch:
diff --git a/tests/cron.test.ts b/tests/cron.test.ts
index 2a2054f..5f14edb 100644
--- a/tests/cron.test.ts
+++ b/tests/cron.test.ts
@@ -1080,6 +1080,29 @@ describe('cron', () => {
 			job.stop();
 			expect(callback).toHaveBeenCalledTimes(1);
 		});
+
+		it('should create recurring job, setTime with actual date, start and run once (#739)', () => {
+			const callback = jest.fn();
+			const clock = sinon.useFakeTimers();
+
+			const job = new CronJob('0 0 20 * * *', callback);
+
+			const startDate = new Date(Date.now() + 5000);
+			job.setTime(new CronTime(startDate));
+
+			job.start();
+
+			clock.tick(5000);
+
+			expect(callback).toHaveBeenCalledTimes(1);
+
+			clock.tick(60000);
+
+			clock.restore();
+
+			expect(callback).toHaveBeenCalledTimes(1);
+			expect(job.running).toBe(false);
+		});
 	});
 
 	describe('nextDate(s)', () => {