Skip to content

credimi/vacation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

giuliacotGiulia Talamonti
and
Giulia Talamonti
Jul 10, 2023
b0e5c64 Â· Jul 10, 2023

History

69 Commits
Jul 31, 2019
Mar 8, 2023
Sep 5, 2019
Jul 31, 2019
Jul 30, 2019
Jul 30, 2019
Jul 10, 2023
Jul 10, 2023
Jul 31, 2019
Jul 30, 2019
Jul 10, 2023
Jul 31, 2019
Jul 10, 2023
Jul 31, 2019
Jul 10, 2023

Repository files navigation

🏖Vacation 🏖

We work hard, but sometimes we just don't 🤷‍♀

@bancacfplus/vacation is a small static module that manages the days we are off or we don't process things

isVacation(date[, options])

A function that accepts a date in YYYY-MM-DD format and respond with a Boolean
Options: see options below

closestWorkingDay(date[, options])

A function that accepts a date in YYYY-MM-DD format and respond with the closest working day.
N.B. if the date passed to the function is a working date, you will have your value back.
Options: see options below

getLastWorkDayOfMonth(year, month[, options])

A function that accepts a year and a month parameter and returns the last working date of the month in YYYY-MM-DD format
Options: see options below

Options

{
  withWeekends?: boolean = true // includes weekends to the valid vacation days check
  withVacations?: boolean = true // includes the days from the vacations array the valid vacation days check
  withHolidays?: boolean = true // includes the holidays from the holidays array to the valid vacation days check
  withLastWorkDayOfMonth?: boolean = false // includes the last working day of the month to the check
}

Extras

You can directly access to the holidays and vacations arrays importing the module

Commands

  • build: builds the package
  • test: yeah sometimes we also do TDD here...
  • makesHolidays: generates holidays array, the data will be saved in .src/data/holidays.ts

if you want to adding region to holidays: check the utils/makesHolidays.js file if you want to add or remove custom vacation days: manually edit the ./src/data/vacations.ts file