Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
nexttime
Advanced tools
Readme
Simple tool set to calculate next event occurring date.
Use NPM to install using;
npm install nexttime --save
NextTime module contains an API to predict next event occurring date or dates.
Lets assume that current date is Tue Dec 01 2015 00:00:00 GMT+0530 (IST)
.
Then following method calls will calculate required events as below;
// Create a NextTime instance
let nextTime = require('nexttime').NextTime;
nextTime.nextDate();
// Wed Dec 02 2015 00:00:00 GMT+0530 (IST)
nextTime.nextDate(new Date(2015, 11, 1));
// Wed Dec 02 2015 00:00:00 GMT+0530 (IST)
nextTime.nextDate(new Date(2015,11,1), new Date(2015,11,4));
// ['Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', 'Wed Dec 02 2015 00:00:00 GMT+0530 (IST)', 'Thu Dec 03 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextDate(new Date(2015,11,4));
// ['Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', 'Wed Dec 02 2015 00:00:00 GMT+0530 (IST)', 'Thu Dec 03 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextWeek();
// Tue Dec 08 2015 00:00:00 GMT+0530 (IST)
nextTime.nextWeek(new Date(2015, 11, 1));
// Tue Dec 08 2015 00:00:00 GMT+0530 (IST)
nextTime.nextWeeks(new Date(2015,11,1), new Date(2015,11,10));
// ['Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', 'Tue Dec 08 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextWeeks(new Date(2015,11,11));
// ['Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', 'Tue Dec 08 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextMonth();
// Fri Jan 01 2016 00:00:00 GMT+0530 (IST)
nextTime.nextMonth(new Date(2015, 11, 1));
// Fri Jan 01 2016 00:00:00 GMT+0530 (IST)
nextTime.nextMonth(new Date(2016,1,29), 31);
// 'Thu Mar 31 2015 00:00:00 GMT+0530 (IST)'
nextTime.nextMonths(new Date(2015,11,31), new Date(2016,2,24));
// ['Thu Dec 31 2015 00:00:00 GMT+0530 (IST)', 'Sun Jan 31 2015 00:00:00 GMT+0530 (IST)', 'Mon Feb 29 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextMonths(new Date(2016,2,24));
// ['Thu Dec 31 2015 00:00:00 GMT+0530 (IST)', 'Sun Jan 31 2015 00:00:00 GMT+0530 (IST)', 'Mon Feb 29 2015 00:00:00 GMT+0530 (IST)']
Get next date after a given date
(optional) Default new Date()
If current date is 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', then following method return 'Wed Dec 02 2015 00:00:00 GMT+0530 (IST)'
nextTime.nextDate();
If feed with a date 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', then following method return 'Wed Dec 02 2015 00:00:00 GMT+0530 (IST)'
nextTime.nextDate(new Date(2015,11,1));
Get next dates between given startDate
and endDate
period
(optional) Default new Date()
(required) If endDate
isn't provided, take startDate
as endDate
If
startDate
is 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)' andendDate
is 'Fri Dec 04 2015 00:00:00 GMT+0530 (IST)', then following method return ['Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', 'Wed Dec 02 2015 00:00:00 GMT+0530 (IST)', 'Thu Dec 03 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextDates(new Date(2015,11,1), new Date(2015,11,4));
If current time is 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)' and call method with 'Fri Dec 04 2015 00:00:00 GMT+0530 (IST)' will return ['Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', 'Wed Dec 02 2015 00:00:00 GMT+0530 (IST)', 'Thu Dec 03 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextDates(new Date(2015,11,4));
Get date of next week for a given date
(optional) Default new Date()
If current date is 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', then following method return 'Tue Dec 08 2015 00:00:00 GMT+0530 (IST)'
nextTime.nextWeek();
If feed with a date 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', then following method return 'Tue Dec 08 2015 00:00:00 GMT+0530 (IST)'
nextTime.nextWeek(new Date(2015,11,1));
Get dates of next weeks between given startDate
and endDate
period
(optional) Default new Date()
(required) If endDate
isn't provided, take startDate
as endDate
If
startDate
is 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)' andendDate
is 'Fri Dec 11 2015 00:00:00 GMT+0530 (IST)', then following method return ['Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', 'Tue Dec 08 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextWeeks(new Date(2015,11,1), new Date(2015,11,10));
If current time is 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)' and call method with 'Fri Dec 11 2015 00:00:00 GMT+0530 (IST)' will return ['Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', 'Tue Dec 08 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextWeeks(new Date(2015,11,11));
Get date of next month for a given date NOTE: When end of month provided, it'll return possible end of next month
(optional) Default new Date()
(optional) Default set to date of date
parameter
If current date is 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', then following method return 'Fri Jan 01 2015 00:00:00 GMT+0530 (IST)'
nextTime.nextMonth();
If feed with a date 'Tue Dec 01 2015 00:00:00 GMT+0530 (IST)', then following method return 'Fri Jan 01 2015 00:00:00 GMT+0530 (IST)'
nextTime.nextMonth(new Date(2015,11,1));
NOTE:
If
upto
provided 'Mon Feb 29 2016 00:00:00 GMT+0530 (IST)', then return 'Thu Mar 31 2015 00:00:00 GMT+0530 (IST)'
nextTime.nextMonth(new Date(2016,1,29), 31);
Get dates of next months between given startDate
and endDate
period
(optional) Default new Date()
(required) If endDate
isn't provided, take startDate
as endDate
If
startDate
is 'Thu Dec 31 2015 00:00:00 GMT+0530 (IST)' andendDate
is 'Thu Mar 24 2016 00:00:00 GMT+0530 (IST)', then following method return ['Thu Dec 31 2015 00:00:00 GMT+0530 (IST)', 'Sun Jan 31 2015 00:00:00 GMT+0530 (IST)', 'Mon Feb 29 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextMonths(new Date(2015,11,31), new Date(2016,2,24));
If current time is 'Thu Dec 31 2015 00:00:00 GMT+0530 (IST)' and call method with 'Thu Mar 24 2016 00:00:00 GMT+0530 (IST)' will return ['Thu Dec 31 2015 00:00:00 GMT+0530 (IST)', 'Sun Jan 31 2015 00:00:00 GMT+0530 (IST)', 'Mon Feb 29 2015 00:00:00 GMT+0530 (IST)']
nextTime.nextMonths(new Date(2016,2,24));
npm install
npm run test
(just tests)npm run test-debug
(test with more debug logs)This Software is licensed under MIT License
Copyright (c) 2015 Gihan Karunarathne gckarunarathne@gmail.com
FAQs
Simple tool set to calculate next event occurring date.
We found that nexttime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).