1.0.0 • Published 1 year ago

cron-timezone-converter v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

cron-timezone-converter

Convert cron expressions between different timezones

Based on cron-timezone-convert, but using date-fns.

Installation

npm i cron-timezone-converter

Usage

The library allows to either use 5 digit or 6 digit cron syntax (i.e. include/exclude seconds)

import { convert } from 'cron-timezone-converter';

// OR

const convert = require("cron-timezone-converter");
convert("0 0 8-10 * * *", "UTC", "US/Arizona");
> "0 0 1-3 * * *"

convert("0 30 23 L * *", "UTC", "Africa/Lagos");
> "0 30 0 1 * *"

// Exclude seconds
convert("0 30 0 1 * *", "Africa/Lagos", "UTC", false);
> "0 0 1 12 *"