Skip to content

meriamBenSassi/dateValidator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Date Validator

  • To instantiate a DateValidator:

let dateValidator = new DateValidator(exludeWeekend, exludeHolidays, beginingTime, endingTime, country, state, region, opts);

exludeWeekend = true if weekd end's dates are considered as invalid

exludeHolidays = true if holidays' dates are considered as invalid

beginingTime & endingTime are an interval of hours in which the date is valid and must be in format: hh:mm

State, region and ops are not required (https://www.npmjs.com/package/date-holidays)

Exemple:

let dateValidator = new DateValidator(true, true, '8:00', '19:00', 'FR');

  • To get the nextValidDate:

dateValidator.nextValidDate(new Date());

nextValidDate return the same date if it's a valid one.

  • other functions:

isValidTime(time)

isValidDate(date)

isWeekend(date)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published