{"name":"cron-parser","version":"2.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","directories":{"test":"test"},"scripts":{"test":"tap ./test/*.js"},"repository":{"type":"git","url":"git+ssh://git@github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":{"name":"Harri Siirak"},"contributors":[{"name":"Daniel Prentis","email":"daniel@salsitasoft.com"},{"name":"Renault John Lecoultre"},{"name":"Richard Astbury","email":"richard.astbury@gmail.com"},{"name":"Meaglin Wasabi","email":"Meaglin.wasabi@gmail.com"},{"name":"Mike Kusold","email":"hello@mikekusold.com"},{"name":"Alex Kit","email":"alex.kit@atmajs.com"},{"name":"Santiago Gimeno","email":"santiago.gimeno@gmail.com"},{"name":"Daniel","email":"darc.tec@gmail.com"},{"name":"Christian Steininger","email":"christian.steininger.cs@gmail.com"},{"name":"Mykola Piskovyi","email":"m.piskovyi@gmail.com"},{"name":"Brian Vaughn","email":"brian.david.vaughn@gmail.com"},{"name":"Nicholas Clawson","email":"nickclaw@gmail.com"},{"name":"Yasuhiroki","email":"yasuhiroki.duck@gmail.com"},{"name":"Nicholas Clawson","email":"nickclaw@gmail.com"},{"name":"Brendan Warkentin","email":"faazshift@gmail.com"}],"license":"MIT","dependencies":{"is-nan":"^1.2.1","moment-timezone":"^0.5.0"},"devDependencies":{"sinon":"^1.17.7","tap":"^0.5.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"gitHead":"34d56c182c608687ffbabf55c9d5580237dc4006","bugs":{"url":"https://github.com/harrisiirak/cron-parser/issues"},"homepage":"https://github.com/harrisiirak/cron-parser#readme","_id":"cron-parser@2.4.0","_shasum":"7c6be0693b90c92c3914fecdae16f88dcef2f437","_from":".","_npmVersion":"4.1.2","_nodeVersion":"6.10.1","_npmUser":{"name":"harrisiirak","email":"harri.siirak@gmail.com"},"maintainers":[{"name":"harrisiirak","email":"harri.siirak@gmail.com"}],"dist":{"shasum":"7c6be0693b90c92c3914fecdae16f88dcef2f437","tarball":"http://registry-npm.ywwl.com/cron-parser/download/cron-parser-2.4.0.tgz","integrity":"sha512-8zAd93POkiZOOa5pXlhjzUH5hHYwjOll5FzLyDf4h46Fgg9D1ICBieoJLlka4v2ms1/tUMMGzVtPnib3vvDvcg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCIIZ/A0xgkMq5knJdufZh1E+DvgDHwtzxgj2WnQIItWAIhAMY8Jft6o2thefcAXJKoYb3xOPC63FlLveZEnAVG5lgp"}],"size":17077,"noattachment":false,"key":"/cron-parser/-/cron-parser-2.4.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/cron-parser-2.4.0.tgz_1491302670698_0.728328219614923"},"readme":"cron-parser\n================\n\n[![Build Status](https://github.com/harrisiirak/cron-parser/actions/workflows/push.yml/badge.svg?branch=master)](https://github.com/harrisiirak/cron-parser/actions/workflows/push.yml)\n[![NPM version](https://badge.fury.io/js/cron-parser.png)](http://badge.fury.io/js/cron-parser)\n\nNode.js library for parsing and manipulating crontab instructions. It includes support for timezones and DST transitions.\n\n__Compatibility__  \nNode >= 12.0.0\nTypeScript >= 4.2\n\nSetup\n========\n```bash\nnpm install cron-parser\n```\n\nSupported format\n========\n\n```\n*    *    *    *    *    *\n┬    ┬    ┬    ┬    ┬    ┬\n│    │    │    │    │    |\n│    │    │    │    │    └ day of week (0 - 7, 1L - 7L) (0 or 7 is Sun)\n│    │    │    │    └───── month (1 - 12)\n│    │    │    └────────── day of month (1 - 31, L)\n│    │    └─────────────── hour (0 - 23)\n│    └──────────────────── minute (0 - 59)\n└───────────────────────── second (0 - 59, optional)\n```\n\nSupports mixed use of ranges and range increments (W character not supported currently). See tests for examples.\n\nUsage\n========\n\nSimple expression.\n\n```javascript\nvar parser = require('cron-parser');\n\ntry {\n  var interval = parser.parseExpression('*/2 * * * *');\n\n  console.log('Date: ', interval.next().toString()); // Sat Dec 29 2012 00:42:00 GMT+0200 (EET)\n  console.log('Date: ', interval.next().toString()); // Sat Dec 29 2012 00:44:00 GMT+0200 (EET)\n\n  console.log('Date: ', interval.prev().toString()); // Sat Dec 29 2012 00:42:00 GMT+0200 (EET)\n  console.log('Date: ', interval.prev().toString()); // Sat Dec 29 2012 00:40:00 GMT+0200 (EET)\n} catch (err) {\n  console.log('Error: ' + err.message);\n}\n\n```\n\nIteration with limited timespan. Also returns ES6 compatible iterator (when iterator flag is set to true).\n\n```javascript\nvar parser = require('cron-parser');\n\nvar options = {\n  currentDate: new Date('Wed, 26 Dec 2012 12:38:53 UTC'),\n  endDate: new Date('Wed, 26 Dec 2012 14:40:00 UTC'),\n  iterator: true\n};\n\ntry {\n  var interval = parser.parseExpression('*/22 * * * *', options);\n\n  while (true) {\n    try {\n      var obj = interval.next();\n      console.log('value:', obj.value.toString(), 'done:', obj.done);\n    } catch (e) {\n      break;\n    }\n  }\n\n  // value: Wed Dec 26 2012 14:44:00 GMT+0200 (EET) done: false\n  // value: Wed Dec 26 2012 15:00:00 GMT+0200 (EET) done: false\n  // value: Wed Dec 26 2012 15:22:00 GMT+0200 (EET) done: false\n  // value: Wed Dec 26 2012 15:44:00 GMT+0200 (EET) done: false\n  // value: Wed Dec 26 2012 16:00:00 GMT+0200 (EET) done: false\n  // value: Wed Dec 26 2012 16:22:00 GMT+0200 (EET) done: true\n} catch (err) {\n  console.log('Error: ' + err.message);\n}\n\n```\n\nTimezone support\n\n```javascript\nvar parser = require('cron-parser');\n\nvar options = {\n  currentDate: '2016-03-27 00:00:01',\n  tz: 'Europe/Athens'\n};\n\ntry {\n  var interval = parser.parseExpression('0 * * * *', options);\n\n  console.log('Date: ', interval.next().toString()); // Date:  Sun Mar 27 2016 01:00:00 GMT+0200\n  console.log('Date: ', interval.next().toString()); // Date:  Sun Mar 27 2016 02:00:00 GMT+0200\n  console.log('Date: ', interval.next().toString()); // Date:  Sun Mar 27 2016 04:00:00 GMT+0300 (Notice DST transition)\n} catch (err) {\n  console.log('Error: ' + err.message);\n}\n```\n\nManipulation \n\n```javascript\nvar parser = require('cron-parser');\n\nvar interval = parser.parseExpression('0 7 * * 0-4');\nvar fields = JSON.parse(JSON.stringify(interval.fields)); // Fields is immutable\nfields.hour = [8];\nfields.minute = [29];\nfields.dayOfWeek = [1,3,4,5,6,7];\nvar modifiedInterval = parser.fieldsToExpression(fields);\nvar cronString = modifiedInterval.stringify();\nconsole.log(cronString); // \"29 8 * * 1,3-7\"\n```\n\nOptions\n========\n\n* *currentDate* - Start date of the iteration\n* *endDate* - End date of the iteration\n\n`currentDate` and `endDate` accept `string`, `integer` and `Date` as input.\n\nIn case of using `string` as input, not every string format accepted\nby the `Date` constructor will work correctly. \nThe supported formats are: \n- [`ISO8601`](https://moment.github.io/luxon/#/parsing?id=iso-8601)\n- [`HTTP and RFC2822`](https://moment.github.io/luxon/#/parsing?id=http-and-rfc2822)\n- [`SQL`](https://moment.github.io/luxon/#/parsing?id=sql) \n\nThe reason being that those are the formats accepted by the\n[`luxon`](https://moment.github.io/luxon/) library which is being used to handle dates.\n\nUsing `Date` as an input can be problematic specially when using the `tz` option. The issue being that, when creating a new `Date` object without\nany timezone information, it will be created in the timezone of the system that is running the code. This (most of times) won't be what the user\nwill be expecting. Using one of the supported `string` formats will solve the issue(see timezone example).\n\n* *iterator* - Return ES6 compatible iterator object \n* *utc* - Enable UTC\n* *tz* - Timezone string. It won't be used in case `utc` is enabled\n\nLast weekday of the month\n=========================\n\nThis library supports parsing the range `0L - 7L` in the `weekday` position of\nthe cron expression, where the `L` means \"last occurrence of this weekday for\nthe month in progress\".\n\nFor example, the following expression will run on the last monday of the month\nat midnight:\n\n```\n0 0 0 * * 1L\n```\n\nThe library also supports combining `L` expressions with other weekday\nexpressions. For example, the following cron will run every Monday as well\nas the last Wednesday of the month:\n\n```\n0 0 0 * * 1,3L\n```\n","publish_time":1491302672704,"_cnpm_publish_time":1491302672704,"dist-tags":{"latest":"5.10.6"}}