{"_id":"@davidwells/human-cron","_rev":"3-ddfd38416da69fa4dec088cb9c102645","name":"@davidwells/human-cron","dist-tags":{"latest":"0.2.2"},"versions":{"0.2.0":{"name":"@davidwells/human-cron","version":"0.2.0","keywords":["cron","crontab","schedule","human-readable","cron-parser","cron-expression"],"author":{"name":"David Wells"},"license":"MIT","_id":"@davidwells/human-cron@0.2.0","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"homepage":"https://github.com/DavidWells/configorama#readme","bugs":{"url":"https://github.com/DavidWells/configorama/issues"},"dist":{"shasum":"acc4481d9d6a08b8e47b9f85d1a6564d508bc50d","tarball":"https://registry.npmjs.org/@davidwells/human-cron/-/human-cron-0.2.0.tgz","fileCount":3,"integrity":"sha512-IH+9R4GNqJf5VSEpSIzQ558JRj4d9BT2+iqN7yU9U10m98DtE7vvvlYlteXD8XkhBlfOzbSaNjh+9DO9C+kz7Q==","signatures":[{"sig":"MEUCID5ADsuNVrKGgsCX2aGh/Yowd5TWOoDzn8+vcwcC8ZdXAiEAxH6v067fWeSEgH6Thcu3tK+k/dYaEOr21nswLXvPvAE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20421},"main":"src/index.js","gitHead":"d287f1fddf313729f29f2bca5eff2e44084a0a79","scripts":{"test":"node src/index.test.js","release:major":"pnpm version major && pnpm publish","release:minor":"pnpm version minor && pnpm publish","release:patch":"pnpm version patch && pnpm publish"},"_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"repository":{"url":"git+https://github.com/DavidWells/configorama.git","type":"git","directory":"packages/human-cron"},"_npmVersion":"11.17.0","description":"Convert human-readable schedule phrases (\"every 5 minutes\", \"weekdays\", \"at 9:30\") into cron expressions, with raw-cron passthrough and validation","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"uvu":"^0.5.6"},"_npmOperationalInternal":{"tmp":"tmp/human-cron_0.2.0_1790458902209_0.5467184050932126","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@davidwells/human-cron","version":"0.2.1","keywords":["cron","crontab","schedule","human-readable","cron-parser","cron-expression"],"author":{"name":"David Wells"},"license":"MIT","_id":"@davidwells/human-cron@0.2.1","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"homepage":"https://github.com/DavidWells/configorama#readme","bugs":{"url":"https://github.com/DavidWells/configorama/issues"},"dist":{"shasum":"b82de66df3f2e7f315eabbbb98d069f23823e622","tarball":"https://registry.npmjs.org/@davidwells/human-cron/-/human-cron-0.2.1.tgz","fileCount":3,"integrity":"sha512-/Z0cj21y+f+AZUGbmO0iIXQ/EMW3cGt6bIz42zuuZMj7EluN+Xxx69M9ZfVvaPFScoPBKPygdyKXvzRDasBBAA==","signatures":[{"sig":"MEQCIBkMuXPiVX28G9QTUo1Qh95sc+p4HZTI06pZ4MluUEgIAiAq7unKhMzuLgZiv6SnknRJDU9F8RyOngaCbBujEzrCfg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQChl6aZ2gV99PPWnU5+eAsJaHROd8NHP3lWuW0yV/eB3QIgVnj350XEVJtpge4j7jB96GB3uPyIPll0Tt6clYKGBG4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20371},"main":"src/index.js","_from":"file:davidwells-human-cron-0.2.1.tgz","scripts":{"test":"node src/index.test.js","release:major":"pnpm version major && pnpm publish","release:minor":"pnpm version minor && pnpm publish","release:patch":"pnpm version patch && pnpm publish"},"_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"_resolved":"/private/var/folders/96/03bz7mms7sb_4bnbr8dcl0sm0000gn/T/644c9bc59cf1d76f612c6b041f92dbad/davidwells-human-cron-0.2.1.tgz","_integrity":"sha512-/Z0cj21y+f+AZUGbmO0iIXQ/EMW3cGt6bIz42zuuZMj7EluN+Xxx69M9ZfVvaPFScoPBKPygdyKXvzRDasBBAA==","repository":{"url":"git+https://github.com/DavidWells/configorama.git","type":"git","directory":"packages/human-cron"},"_npmVersion":"11.17.0","description":"Convert human-readable schedule phrases (\"every 5 minutes\", \"weekdays\", \"at 9:30\") into cron expressions, with raw-cron passthrough and validation","directories":{},"_nodeVersion":"22.22.1","_hasShrinkwrap":false,"devDependencies":{"uvu":"^0.5.6"},"_npmOperationalInternal":{"tmp":"tmp/human-cron_0.2.1_1790461635140_0.15038647610013434","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"_id":"@davidwells/human-cron@0.2.2","bugs":{"url":"https://github.com/DavidWells/configorama/issues"},"dist":{"shasum":"467a7b34a6f95cc3ee09b4083908fe0089a65ad7","tarball":"https://registry.npmjs.org/@davidwells/human-cron/-/human-cron-0.2.2.tgz","fileCount":3,"integrity":"sha512-6MSqUjG/UW5wXAbM5XVSVR51qVYaRX5nSNA2XPV7MTMtImM56c/b3UaLCi6HcvsUQfUM4K6okYG8AGNcBanTRg==","signatures":[{"sig":"MEUCIQDxF95IvV8WW5Fb9VIoZJ4BnhCekJKEc9iMa75OIttH3AIgMQJwzJI00cqsA6yp6ksky1MTC8cbqRzIiJBR18c7564=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGD+wZGiHKw1QzLYmjCbg5BnYKKxTLJY/gG1K52MMrdkAiBT6ykiFeEqW9dTYH90aI+snKUFswbAITpKgPlyB77/1g=="}],"unpackedSize":20371},"main":"src/index.js","name":"@davidwells/human-cron","_from":"file:davidwells-human-cron-0.2.2.tgz","author":{"name":"David Wells"},"license":"MIT","scripts":{"test":"node src/index.test.js","release:major":"pnpm version major && pnpm publish","release:minor":"pnpm version minor && pnpm publish","release:patch":"pnpm version patch && pnpm publish"},"version":"0.2.2","_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"homepage":"https://github.com/DavidWells/configorama#readme","keywords":["cron","crontab","schedule","human-readable","cron-parser","cron-expression"],"_resolved":"/private/var/folders/96/03bz7mms7sb_4bnbr8dcl0sm0000gn/T/d88e494e71af1865df8df3e5da55b03f/davidwells-human-cron-0.2.2.tgz","_integrity":"sha512-6MSqUjG/UW5wXAbM5XVSVR51qVYaRX5nSNA2XPV7MTMtImM56c/b3UaLCi6HcvsUQfUM4K6okYG8AGNcBanTRg==","repository":{"url":"git+https://github.com/DavidWells/configorama.git","type":"git","directory":"packages/human-cron"},"_npmVersion":"11.17.0","description":"Convert human-readable schedule phrases (\"every 5 minutes\", \"weekdays\", \"at 9:30\") into cron expressions, with raw-cron passthrough and validation","directories":{},"maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"_nodeVersion":"22.22.1","_hasShrinkwrap":false,"devDependencies":{"uvu":"^0.5.6"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/human-cron_0.2.2_1790609448952_0.9689975077130872"}}},"time":{"created":"2026-09-26T21:41:41.950Z","modified":"2026-09-28T15:30:49.761Z","0.2.0":"2026-09-26T21:41:42.323Z","0.2.1":"2026-09-26T22:27:15.215Z","0.2.2":"2026-09-28T15:30:49.026Z"},"bugs":{"url":"https://github.com/DavidWells/configorama/issues"},"author":{"name":"David Wells"},"license":"MIT","homepage":"https://github.com/DavidWells/configorama#readme","keywords":["cron","crontab","schedule","human-readable","cron-parser","cron-expression"],"repository":{"url":"git+https://github.com/DavidWells/configorama.git","type":"git","directory":"packages/human-cron"},"description":"Convert human-readable schedule phrases (\"every 5 minutes\", \"weekdays\", \"at 9:30\") into cron expressions, with raw-cron passthrough and validation","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"readme":"# @davidwells/human-cron\n\nConvert human-readable schedule phrases into cron expressions — with raw-cron passthrough and validation.\n\n`cronstrue` turns a cron string into English; **human-cron goes the other way**: English (and interval/time phrases) into a cron string. It also validates and passes through raw cron expressions unchanged, so you can accept either form from users.\n\n## Install\n\n```bash\nnpm install @davidwells/human-cron\n```\n\n## Usage\n\n```js\nconst { parseCron, isValidCron } = require('@davidwells/human-cron')\n\n// Human-readable phrases\nparseCron('every minute')        // => '* * * * *'\nparseCron('every 5 minutes')     // => '*/5 * * * *'\nparseCron('every five minutes')  // => '*/5 * * * *'   (spelled-out numbers work too)\nparseCron('every twenty-five minutes') // => '*/25 * * * *'\nparseCron('weekdays')            // => '0 0 * * 1-5'\nparseCron('at 9:30 pm')          // => '30 21 * * *'\nparseCron('at 9pm')              // => '0 21 * * *'   (bare hour, minutes default to 0)\nparseCron('at noon')             // => '0 12 * * *'\nparseCron('on monday at 9:00')   // => '0 9 * * 1'\nparseCron('on 15th of month at 9:30 am') // => '30 9 15 * *'\n\n// Raw cron passes through unchanged (standard, AWS/Quartz, @macros)\nparseCron('0 12 * * *')          // => '0 12 * * *'\nparseCron('0 12 * * ? *')        // => '0 12 * * ? *'   (Quartz ? day placeholder)\nparseCron('0 0 15W * ?')         // => '0 0 15W * ?'    (nearest-weekday)\nparseCron('0 9 * * MON-FRI')     // => '0 9 * * MON-FRI'\n\n// Invalid input throws\nparseCron('not a schedule')      // throws: Unrecognized cron pattern\nparseCron('0 12 xyz * ? *')      // throws: invalid field\n```\n\n### `parseCron(input) => string`\n\nReturns a cron expression for a recognized phrase, or the raw cron unchanged if it's already valid. Throws on empty/non-string input or an unrecognized/invalid pattern.\n\n### `isValidCron(str) => boolean`\n\n`true` if `str` is an `@macro` or 5–7 space-separated cron fields (each using valid cron syntax, including `?`, `L`, `W`, `#`, and day/month names). Never throws.\n\n### `CRON_PATTERNS`\n\nThe phrase → cron map used by `parseCron`, exported for reference.\n\n## Supported phrases\n\n- **Intervals:** `every minute|hour|day|week|month|year`, `every N minutes|hours|days|weeks|months` (and bare `5 minutes`, `a minute`/`an hour`, unit abbreviations `15m`/`2h`/`every 15 min`), `every other <unit>` (= every 2), `hourly`/`daily`/`weekly`/`monthly`/`yearly`. `N` may be a digit or spelled out (`five`, `twenty-five`). Whole-multiple intervals roll up to the next unit (`every 60 minutes` → hourly, `every 24 hours` → daily); intervals no single cron can express throw (`every 90 minutes`, `every 25 hours`).\n- **Frequency words:** `once a day|week|hour`, `twice a day` (→ midnight and noon), `every half hour` (`*/30`), `every quarter hour` (`*/15`)\n- **Business:** `weekdays`, `weekends`, `business hours`, `after hours`\n- **Times of day:** `midnight`, `noon`, `morning`, `evening`, `H[:MM][am|pm]` with or without a leading `at` (`9am`, `3pm`, `9:30`, `at 9`, `at 9:30 pm`), `at <midnight|noon|morning|evening>`\n- **Schedule + time:** any day/base phrase followed by `at <time>` — `every day at noon`, `daily at midnight`, `weekdays at 9:30`, `weekends at 10`, `monday at 9`, `fridays at 5pm`, `every sunday at 3pm`, `on monday and friday at 9`, `hourly at 30` (minute of every hour)\n- **Days:** `monday`…`sunday`, abbreviations and plurals (`mon`, `tuesdays`, `on sundays`), `every`/`each <day>`, ranges (`mon-fri`, `monday to friday`), lists (`monday and friday`)\n- **Month:** `first|last day of month`, `first|last of month`, `beginning|start|end of month`, `middle of month`, `on the Nth[,Mth…]` (→ midnight), `on Nth[,Mth…] of month at H:MM`\n- **Special:** `reboot`/`startup` (`@reboot`), `never`\n\n## License\n\nMIT\n","readmeFilename":"README.md"}