@quartz/holidays
Advanced tools
Comparing version 1.1.0 to 1.2.0
23
index.js
const { allForYear } = require( '@18f/us-federal-holidays' ); | ||
// Sometimes we get the day off. | ||
const oneOffHolidays = { | ||
2020: [ | ||
{ | ||
name: 'Monday after Indepedence Day', | ||
date: new Date( '2020-07-06' ), | ||
dateString: '2020-7-6', | ||
}, | ||
], | ||
}; | ||
function getHolidays( year ) { | ||
@@ -20,6 +31,14 @@ // Expect a reasonable year. This code will die. | ||
// Remove Veterans Day and Columbus Day. | ||
const removeUnobserved = ( { name } ) => ! [ 'veterans', 'columbus' ].includes( name.toLowerCase() ); | ||
return [ | ||
// Remove Veterans Day. | ||
...fedHolidays.filter( ( { name } ) => ! name.toLowerCase().includes( 'veteran' ) ), | ||
...fedHolidays.filter( removeUnobserved ), | ||
...( oneOffHolidays[ year ] || [] ), | ||
{ | ||
name: 'Juneteenth', | ||
date: new Date( `${year}-06-19` ), | ||
dateString: `${year}-6-19`, | ||
}, | ||
{ | ||
name: 'Day after Thanksgiving', | ||
@@ -26,0 +45,0 @@ date: blackFriday, |
{ | ||
"name": "@quartz/holidays", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Quartz holidays", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,2 +28,3 @@ const test = require( 'tape' ); | ||
t.ok( isHoliday( new Date( '2019-01-01' ) ), 'New Year\'s 2019' ); | ||
t.ok( isHoliday( new Date( '2023-06-19' ) ), 'Juneteenth 2023' ); | ||
t.ok( isHoliday( new Date( '2019-12-08' ), { weekends: true } ), 'a random Sunday' ); | ||
@@ -30,0 +31,0 @@ |
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
4676
84