All Projects → trapcodeio → cron-time

trapcodeio / cron-time

Licence: other
Javascript Cron Time Expressions

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cron-time

php-cron-expr
Ultra lightweight, Dependency free and Super Fast Cron Expression parser for PHP
Stars: ✭ 42 (-27.59%)
Mutual labels:  cron, cron-expression
point-vue-cron
vue component: cron expression generator
Stars: ✭ 21 (-63.79%)
Mutual labels:  cron, cron-expression
angular-cron-gen
A basic way to for users to graphically build a cron expression using Angular.
Stars: ✭ 36 (-37.93%)
Mutual labels:  cron, cron-expression
crontab
cron expression parser and executor for dotnet core.
Stars: ✭ 13 (-77.59%)
Mutual labels:  cron, cron-expression
cron-schedule
A zero-dependency cron parser and scheduler for Node.js, Deno and the browser.
Stars: ✭ 28 (-51.72%)
Mutual labels:  cron, cron-expression
croncpp
A C++11/14/17 header-only cross-platform library for handling CRON expressions
Stars: ✭ 162 (+179.31%)
Mutual labels:  cron, cron-expression
cron-validate
A cron-expression validator for TypeScript/JavaScript projects.
Stars: ✭ 40 (-31.03%)
Mutual labels:  cron, cron-expression
aws-tag-sched-ops
Retired, please see https://github.com/sqlxpert/lights-off-aws
Stars: ✭ 24 (-58.62%)
Mutual labels:  cron
chadburn
Chadburn is a scheduler alternative to cron, built on Go and designed for Docker environments.
Stars: ✭ 54 (-6.9%)
Mutual labels:  cron
nextjs-cron
Cron jobs with Github Actions for Next.js apps on Vercel▲
Stars: ✭ 144 (+148.28%)
Mutual labels:  cron
vue-cron-editor
Vue component for easier editing of cron expressions.
Stars: ✭ 61 (+5.17%)
Mutual labels:  cron
time.clj
time util for Clojure(Script)
Stars: ✭ 45 (-22.41%)
Mutual labels:  cron
watchman
📆 更夫(watchman)是一款可视化的定时任务配置 Web 工具,麻麻不用担心我漏掉任何更新啦!
Stars: ✭ 40 (-31.03%)
Mutual labels:  cron
cronode
Cron for Node.js with expressive code
Stars: ✭ 15 (-74.14%)
Mutual labels:  cron
rhythm
Time-based job scheduler for Apache Mesos
Stars: ✭ 30 (-48.28%)
Mutual labels:  cron
btrfs-backup
A simple, flexible script for versioned backups using btrfs and rsync
Stars: ✭ 59 (+1.72%)
Mutual labels:  cron
webping
🚦 Python script to monitor web pages.
Stars: ✭ 20 (-65.52%)
Mutual labels:  cron
hubot-schedule
A hubot script to schedule a message in both cron-style and datetime-based format pattern
Stars: ✭ 46 (-20.69%)
Mutual labels:  cron
transferwisely
Batch process using transfer-wise API to automatically track, detect and book transfers for you at better rates.
Stars: ✭ 20 (-65.52%)
Mutual labels:  cron
slacker
Simple smtp email server which redirects emails to slack.
Stars: ✭ 24 (-58.62%)
Mutual labels:  cron

Cron-Time

Cron Time Expression Generator/Builder written in Typescript.

Tested on CronTab.Guru

Install

npm install cron-time-generator

OR

yarn add cron-time-generator

Usage

const cronTime = require('cron-time-generator');
// OR (Typescript)
import cronTime from "cron-time-generator";

cronTime.everyMinute();
// * * * * *

cronTime.everyHour();
// 0 * * * *

cronTime.everyDay();
// 0 0 * * *

cronTime.everyDayAt(6);
// 0 6 * * *

cronTime.everyDayAt(6, 15);
// 15 6 * * *

cronTime.everySunday();
// 0 0 * * SUN

cronTime.everySundayAt(4, 30);
// 30 4 * * SUN

cronTime.everyWeekDay();
// 0 0 * * 1-5
// from Monday to Friday

cronTime.everyWeekDayAt(1, 30);
// 30 1 * * 1-5
// 1:30 AM from Monday to Friday

cronTime.everyWeekend();
// 0 0 * * 6,0
// on Saturday and Sunday

cronTime.everyWeekendAt(1, 30);
// 30 1 * * 6,0
// 1:30 AM on Saturday and Sunday

// E.T.C

For everyWeekDay and everyWeekend there is also an option to change the starting day.

By default, week days is from Monday to Friday while weekend days are Saturdays and Sundays

This can be changed like so:

cronTime.everyWeekDay("sunday", "thursday");
// 0 0 * * 0-4
// from Sunday to Thursday

cronTime.everyWeekDayAt(1, 30, "sunday", "thursday");
// 30 1 * * 0-4
// 1:30 AM from Sunday to Thursday

cronTime.everyWeekend("friday", "saturday");
// 0 0 * * 5,6
// on Friday and Saturday

cronTime.everyWeekendAt(1, 30, "friday", "saturday");
// 30 1 * * 5,6
// 1:30 AM on Friday and Saturday

Note: if a startDay is specified then an endDay must be specified also, else it will use the default values which may not tally with your new $startDay

Every method of CronTime returns exactly what its name says.

onSpecificDays and onSpecificDaysAt

To target specific days

cronTime.onSpecificDays(['sunday', 'tuesday', 'thursday']); // 0 0 * * 0,2,4

// With time 
cronTime.onSpecificDaysAt(['sunday', 'tuesday', 'thursday'], 3, 30); // 0 0 * * 0,2,4

Every Nth Time

const cronTime = require('cron-time-generator');

cronTime.every(5).minutes();
// Every Five Minutes

cronTime.every(2).hours();
// Every 2 Hours

cronTime.every(7).days();
// Every 7 Days

cronTime.every(7).days(9, 5);
// Every 7 days at 9:05

cronTime.every('even').hours();
// Every Even Hours
// * */2 * * *

cronTime.every('uneven').hours();
// Every Uneven Hours
// * 1-23/2 * * *

Between

const cronTime = require('cron-time-generator');

cronTime.between(1, 4).days();
// Between  1 - 4 th day of the month 

All Functions

every

between

everyMinute

everyHour

everyHourAt(minuteOfTheHour)

everyDay

everyDayAt(hourOfTheDay)

everySunday

everySundayAt(hour, minute?)

everyMonday

everyMondayAt(hour, minute?)

everyTuesday

everyTuesdayAt(hour, minute?)

everyWednesday

everyWednesdayAt(hour, minute?)

everyThursday

everyThursdayAt(hour, minute?)

everyFriday

everyFridayAt(hour, minute?)

everySaturday

everySaturdayAt(hour, minute?)

everyWeek

everyWeekAt(day, hour?, minute?)

everyWeekDay

everyWeekDayAt(hour, $minute, startDay, endDay)

everyWeekend

everyWeekendAt(hour, minute, startDay, endDay)

everyMonth

everyMonthOn(day, hour?, minute?)

everyYear

everyYearIn(month, day?, hour?, minute?)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].