0.2.11 • Published 6 months ago

crontext v0.2.11

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Crontext

codecov

:warning: This package is currently under development. Not meant for production use.

Parses natural text to a cron schedule format.

Try it out live here: https://www.crontext.io

npm install crontext

Usage

import { parseText, nextDate } from 'crontext';

const cron = parseText('Every weekday');
// 0 9 * * 1-5

const nextOccurence = nextDate(cron, new Date());

Custom Options

import { parseText } from 'crontext';

parseText('Every Monday', { defaultHour: '8', defaultMinute: '30' });
// 30 8 * * 1
// aka 8:30am every Monday

parseText('Every weekday', { preset: 'system' });
// 0 0 * * 1-5
// 'system' is the same as: { defaultHour: 0, defaultMinute: 0 }

Configuration

All configurations are optional. The default start of day is 9am. A 'weekday' is considered Monday-Friday and 'weekend' is Saturday or Sunday.

OptionDescriptionDefault
preset'system' as a preset will use 00:00 as the start of the day.n/a
defaultHourWhat hour should each day start on. This is the default used when using non specific times like 'Every Monday''9'
defaultMinuteWhat minute should each day start on. This is the default used when using non specific times like 'Every Monday''0'
startDateWhat starting date to use for relative schedules like "tomorrow", "next month", etc.Right now - aka new Date()
startOfWeekWhich day starts the week. Used for relative schedules like "next week"'1'

Interested in Contributing? Check out the Contribution guide.

0.2.11

6 months ago

0.2.10

7 months ago

0.2.9

7 months ago

0.2.8

7 months ago

0.2.7

7 months ago

0.2.6

7 months ago

0.2.5

7 months ago

0.2.4

7 months ago

0.2.3

7 months ago

0.2.2

7 months ago

0.2.1

7 months ago

0.2.0

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago