Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 1.05 KB

README.md

File metadata and controls

38 lines (31 loc) · 1.05 KB

SchedulerBuilder

This is a simple ISO8601 repeating interval builder for the <repeat>/<start>/<duration> notation only.

CI

HOW TO USE

import {
    SchedulerBuilder,
    DAY
} from './src'


const schedule = new SchedulerBuilder()
    .from('2018-04-10T00:00:00Z')
    .to('2018-06-10T00:00:00Z')
    .every(DAY.MONDAY)
    .at('14')
    .build()

console.log(schedule); // ['R8/2018-04-16T14:00:00.000Z/P0Y0M56DT0H0M']

You can also schedule multiple days :

const schedule = new SchedulerBuilder()
                .from('2018-04-10T00:00:00Z')
                .to('2018-06-10T00:00:00Z')
                .every(DAY.MONDAY)
                .and
                .every(DAY.THURSDAY)
                .at('14:30')
                .build()
console.log(schedule); // [ 'R8/2018-04-16T14:00:00.000Z/P0Y0M56DT0H0M','R9/2018-04-10T14:00:00.000Z/P0Y0M63DT0H0M' ]

See the DAY enum for more information.