italian-holidays
Advanced tools
Comparing version 1.2.0 to 1.3.0
17
index.js
@@ -387,2 +387,19 @@ const holidays_IT = { | ||
} | ||
} | ||
export function getHolidaysOnlyDays(year = '') { | ||
if (!year || year == '') { | ||
const everyYearUnited = [...holidays_IT[2019], ...holidays_IT[2020], ...holidays_IT[2021], ...holidays_IT[2022], ...holidays_IT[2023]]; | ||
return everyYearUnited.map(holiday => { | ||
return holiday.day; | ||
}, []); | ||
} else { | ||
if (!['2019', '2020', '2021', '2022', '2023'].includes(year.toString())) { | ||
throw new Error('Year not (yet) available'); | ||
} else { | ||
return [...holidays_IT[year]].map(holiday => { | ||
return holiday.day; | ||
}, []); | ||
} | ||
} | ||
} |
{ | ||
"name": "italian-holidays", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "tool to retrieve italian holidays", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,4 @@ ![npm (scoped)](https://img.shields.io/npm/v/@marikamella/ita-holidays) | ||
**only italian language available (english language coming soon)** | ||
**only from 2019 to 2023 (for now)** | ||
**only from 2019 to 2023 (for now)** | ||
**some things are hardcoded af but this is a 10 minutes project, improvements are on their way** | ||
@@ -16,2 +17,15 @@ usage: | ||
`console.log(ita-holidays.getHolidays(2019, 'it'));` | ||
`console.log(ita-holidays.getHolidays(2019, 'it'));` | ||
this will get an object like this: | ||
`{` | ||
`id: 1,` | ||
`day: '01/01/2019',` | ||
`weekDay: 'martedì',` | ||
`name: 'capodanno'` | ||
`}` | ||
`console.log(ita-holidays.getHolidaysOnlyDays(2019));` | ||
**year is optional** | ||
this will get an array of dates formatted like this: DD/MM/YYYY | ||
if year is omitted, the array will include dates from current year to 2023 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11132
402
29