Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cron-translate

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cron-translate

Translates text to cron expression

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

cron-translate

Translate english to cron expressions

Usage

Install cron-translate

npm install --save cron-translate
const cronTranslate = require('cron-translate');

let cron = cronTranslate.toCron('every minute');

Syntax

cron-translate allows to use some fields and operators to compose the expressions that are translatable to cron expressions

Fields

The allowed fields are second, minute, hour, day, month, week day, or the plurals seconds, minutes, hours, days, months, week days.

Operators

  • every operator may be used in three ways:
    • every <field>: sets the field value to *. e.g: every day;
    • every <value> <field>: sets the field value to */<value>. e.g: every 10 minutes;
    • every <field> <value>: sets the field value to <value>. e.g: every hour 2;
  • on operator may be use as the every <field> value:
    • on <field> <value>: sets the field value to <value>. e.g: on hour 2;
  • from to operator is used to create ranges.
    • from <field> <value1> to <value2>: It sets the field value <value1>-<value2>. e.g: from minute 2 to 10;

Values

The allowed values are:

  • Numbers: for all fields.
  • Names: for months and week days, full names and abreviations are allowed. e.g: monday and mon are the same.

Examples

Every usage

  • every second is converted to * * * * * *;
  • every minute is converted to 0 * * * * *;
  • every hour is converted to 0 0 * * * *;
  • every sunday is converted to 0 0 0 * * sunday;
  • every january is converted to 0 0 0 * january *;
  • every 2 minutes is converted to 0 */2 * * * *;
  • every day 10 is converted to 0 0 0 10 * *;

On usage

  • on minute 2 is converted to 0 2 * * * *;
  • on sat is converted to 0 0 0 * * sat;

From to usage

  • from minute 2 to 30 is converted to 0 2-30 * * * *;

Combining expressions

The expressions may be combined to create complex cron expresions:

  • every 10 minutes from hour 2 to 8 is converted to 0 */10 2-8 * * *;
  • every monday on hour 2 from minute 10 to 20 is converted to 0 10-20 2 * * monday;

Keywords

FAQs

Package last updated on 05 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc