Skip to content

A typescript (javascript) library which helps to calculate future timestamps for an event.

License

Notifications You must be signed in to change notification settings

Ilya33/event-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

event-time

A typescript (javascript) library which helps to calculate future timestamps for an event.

Install

npm i event-time

Usage

JavaScript

const EventTime = require('event-time').EventTime;

const eventTime = new EventTime();


// add single timestamp
eventTime.addEventTime({
    fromTimestamp: new Date().getTime() + 3600000
});

// add timestamp with repeat
eventTime.addEventTime({
    fromTimestamp: 1530000000000,
    repeatInterval: 4000000000
});

// add repeat every Sunday (0), Monday (1), Wednesday (3) and Saturday (6)
// after 1530000000000 at timestamp's time
eventTime.addEventTime({
    fromTimestamp: 1530000000000,
    repeatEvery: {
        daysOfWeek: [0, 1, 3, 6]
    }
});

// add repeat every 10 months in current time zone
// after 1530000000000 at timestamp's time
eventTime.addEventTime({
    fromTimestamp: 1530000000000,
    repeatEvery: {
        months: 10
    }
});


// get 8 timestamps after new Date().getTime()
const results0 = eventTime.next(8);

// get 5 timestamps after 2560000000000
const results1 = eventTime.nextAfter(5, 2560000000000);

See also

Later

License

MIT

About

A typescript (javascript) library which helps to calculate future timestamps for an event.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published