us-holidays-helper
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -283,2 +283,12 @@ // src/index.ts | ||
} | ||
function isDateAHoliday(date, holidaysToInclude) { | ||
const isAHoliday = isInHolidayList(date, (year) => { | ||
const allHolidaysThisYear = getHolidays(year); | ||
return Object.keys(getHolidays(year)).filter((holiday) => holidaysToInclude.includes(holiday)).reduce((filtered, holiday) => { | ||
filtered[holiday] = allHolidaysThisYear[holiday]; | ||
return filtered; | ||
}, {}); | ||
}); | ||
return isAHoliday; | ||
} | ||
export { | ||
@@ -308,2 +318,3 @@ getBankHolidays, | ||
isBankHoliday, | ||
isDateAHoliday, | ||
isFederalHoliday, | ||
@@ -310,0 +321,0 @@ isHoliday, |
@@ -393,3 +393,13 @@ "use strict"; | ||
} | ||
function isDateAHoliday(date, holidaysToInclude) { | ||
const isAHoliday = isInHolidayList(date, (year) => { | ||
const allHolidaysThisYear = getHolidays(year); | ||
return Object.keys(getHolidays(year)).filter((holiday) => holidaysToInclude.includes(holiday)).reduce((filtered, holiday) => { | ||
filtered[holiday] = allHolidaysThisYear[holiday]; | ||
return filtered; | ||
}, {}); | ||
}); | ||
return isAHoliday; | ||
} | ||
})(); | ||
//# sourceMappingURL=index.js.map |
@@ -47,3 +47,4 @@ declare type Holiday = "christmas" | "easter" | "halloween" | "valentinesDay" | "mothersDay" | "indigenousPeoplesDay" | "independenceDay" | "presidentsDay" | "laborDay" | "veteransDay" | "thanksgiving" | "newYearsEve" | "martinLutherKingJrDay" | "newYearsDay" | "fathersDay" | "memorialDay" | "goodFriday" | "juneteenth"; | ||
declare function isBankHoliday(date: Date): boolean; | ||
declare function isDateAHoliday(date: Date, holidaysToInclude: Array<Holiday>): boolean; | ||
export { Holiday, Holidays, getBankHolidays, getChristmas, getEaster, getFathersDay, getFederalHolidays, getGoodFriday, getHalloween, getHolidays, getIndependenceDay, getIndigenousPeoplesDay, getJuneteenth, getLaborDay, getMartinLutherKingJrDay, getMemorialDay, getMothersDay, getNewYearsDay, getNewYearsEve, getObservedHolidays, getPresidentsDay, getThanksgiving, getValentinesDay, getVeteransDay, isBankHoliday, isFederalHoliday, isHoliday, isInHolidayList }; | ||
export { Holiday, Holidays, getBankHolidays, getChristmas, getEaster, getFathersDay, getFederalHolidays, getGoodFriday, getHalloween, getHolidays, getIndependenceDay, getIndigenousPeoplesDay, getJuneteenth, getLaborDay, getMartinLutherKingJrDay, getMemorialDay, getMothersDay, getNewYearsDay, getNewYearsEve, getObservedHolidays, getPresidentsDay, getThanksgiving, getValentinesDay, getVeteransDay, isBankHoliday, isDateAHoliday, isFederalHoliday, isHoliday, isInHolidayList }; |
@@ -46,2 +46,3 @@ "use strict"; | ||
isBankHoliday: () => isBankHoliday, | ||
isDateAHoliday: () => isDateAHoliday, | ||
isFederalHoliday: () => isFederalHoliday, | ||
@@ -320,2 +321,12 @@ isHoliday: () => isHoliday, | ||
} | ||
function isDateAHoliday(date, holidaysToInclude) { | ||
const isAHoliday = isInHolidayList(date, (year) => { | ||
const allHolidaysThisYear = getHolidays(year); | ||
return Object.keys(getHolidays(year)).filter((holiday) => holidaysToInclude.includes(holiday)).reduce((filtered, holiday) => { | ||
filtered[holiday] = allHolidaysThisYear[holiday]; | ||
return filtered; | ||
}, {}); | ||
}); | ||
return isAHoliday; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -346,2 +357,3 @@ 0 && (module.exports = { | ||
isBankHoliday, | ||
isDateAHoliday, | ||
isFederalHoliday, | ||
@@ -348,0 +360,0 @@ isHoliday, |
{ | ||
"name": "us-holidays-helper", | ||
"description": "The purpose of this project is to give an interface to work with holidays using date-fns", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"author": "Original: Jon Stuebe / Modified: Brady Holt", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -44,2 +44,3 @@ | ||
- [isBankHoliday](README.md#isbankholiday) | ||
- [isDateAHoliday](README.md#isdateaholiday) | ||
- [isFederalHoliday](README.md#isfederalholiday) | ||
@@ -531,2 +532,23 @@ - [isHoliday](README.md#isholiday) | ||
### isDateAHoliday | ||
▸ **isDateAHoliday**(`date`, `holidaysToInclude`): `boolean` | ||
#### Parameters | ||
| Name | Type | | ||
| :------ | :------ | | ||
| `date` | `Date` | | ||
| `holidaysToInclude` | [`Holiday`](README.md#holiday)[] | | ||
#### Returns | ||
`boolean` | ||
#### Defined in | ||
[index.ts:343](https://github.com/bradymholt/us-holidays-helper/blob/main/src/index.ts#L343) | ||
___ | ||
### isFederalHoliday | ||
@@ -533,0 +555,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
107744
1127
611