date-fns-holidays 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -19,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
19
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
20
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
22
+ SOFTWARE.
package/README.md CHANGED
@@ -17,7 +17,8 @@ The API will be the same as the original project, with the primary focus being b
17
17
  * [Holiday](#holiday-1)
18
18
  * [getBlackFriday()](#getblackfriday)
19
19
  * [getBoxingDay()](#getboxingday)
20
- * [getChristmas()](#getchristmas)
20
+ * [~~getChristmas()~~](#getchristmas)
21
+ * [getChristmasDay()](#getchristmasday)
21
22
  * [getChristmasEve()](#getchristmaseve)
22
23
  * [getColumbusDay()](#getcolumbusday)
23
24
  * [getEaster()](#geteaster)
@@ -68,6 +69,7 @@ type Holiday =
68
69
  | "blackFriday"
69
70
  | "boxingDay"
70
71
  | "christmas"
72
+ | "christmasDay"
71
73
  | "christmasEve"
72
74
  | "columbusDay"
73
75
  | "easter"
@@ -105,7 +107,7 @@ type HolidayList = Record<string, {
105
107
  }>;
106
108
  ```
107
109
 
108
- Defined in: [types/index.ts:36](https://github.com/nktnet1/date-fns-holidays/blob/main/src/types/index.ts#L36)
110
+ Defined in: [types/index.ts:37](https://github.com/nktnet1/date-fns-holidays/blob/main/src/types/index.ts#L37)
109
111
 
110
112
  Mapping of holiday names to their computed date values.
111
113
 
@@ -120,7 +122,7 @@ only the date is relevant.
120
122
  type Holidays = { [K in Holiday]: { bankHoliday: boolean; date: Date; federal: boolean } };
121
123
  ```
122
124
 
123
- Defined in: [types/index.ts:46](https://github.com/nktnet1/date-fns-holidays/blob/main/src/types/index.ts#L46)
125
+ Defined in: [types/index.ts:47](https://github.com/nktnet1/date-fns-holidays/blob/main/src/types/index.ts#L47)
124
126
 
125
127
  Complete set of holidays returned by [getHolidays](#getholidays).
126
128
 
@@ -199,13 +201,39 @@ The returned [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe
199
201
 
200
202
  ***
201
203
 
202
- #### getChristmas()
204
+ #### ~~getChristmas()~~
203
205
 
204
206
  ```ts
205
207
  function getChristmas(year): Date;
206
208
  ```
207
209
 
208
- Defined in: [holiday/getChristmas.ts:14](https://github.com/nktnet1/date-fns-holidays/blob/main/src/holiday/getChristmas.ts#L14)
210
+ Defined in: [holiday/getChristmas.ts:11](https://github.com/nktnet1/date-fns-holidays/blob/main/src/holiday/getChristmas.ts#L11)
211
+
212
+ ##### Parameters
213
+
214
+ | Parameter | Type | Description |
215
+ | ------ | ------ | ------ |
216
+ | `year` | `number` | The year for which to obtain Christmas Day. |
217
+
218
+ ##### Returns
219
+
220
+ [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
221
+
222
+ A [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) representing December 25 of the specified year.
223
+
224
+ ##### Deprecated
225
+
226
+ Use [getChristmasDay](#getchristmasday) instead.
227
+
228
+ ***
229
+
230
+ #### getChristmasDay()
231
+
232
+ ```ts
233
+ function getChristmasDay(year): Date;
234
+ ```
235
+
236
+ Defined in: [holiday/getChristmasDay.ts:14](https://github.com/nktnet1/date-fns-holidays/blob/main/src/holiday/getChristmasDay.ts#L14)
209
237
 
210
238
  Returns the date of Christmas Day for the specified year.
211
239
 
@@ -843,7 +871,7 @@ Only holidays marked as federal holidays are included in the returned list.
843
871
  function getHolidays(year): Holidays;
844
872
  ```
845
873
 
846
- Defined in: [holidays/getHolidays.ts:42](https://github.com/nktnet1/date-fns-holidays/blob/main/src/holidays/getHolidays.ts#L42)
874
+ Defined in: [holidays/getHolidays.ts:43](https://github.com/nktnet1/date-fns-holidays/blob/main/src/holidays/getHolidays.ts#L43)
847
875
 
848
876
  Returns the complete set of supported holidays for the specified year.
849
877
 
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("date-fns");function t(t,r){return n((0,e.setDate)(t,1),r)}function n(t,n){return(0,e.getDay)(t)===n||(t=(0,e.getDay)(t)>n?(0,e.addDays)(t,7-(0,e.getDay)(t)+n):(0,e.addDays)(t,n-(0,e.getDay)(t))),t}function r(t,n){return(0,e.getDay)(t)===n||(t=(0,e.getDay)(t)>n?(0,e.addDays)(t,-1*((0,e.getDay)(t)-n)):(0,e.addDays)(t,-1*((0,e.getDay)(t)-0+(7-n)))),t}function i(t,n){return r((0,e.lastDayOfMonth)(t),n)}function a(n){return(0,e.addWeeks)(t(new Date(n,10),4),3)}function o(t){return(0,e.addDays)(a(t),1)}function s(e){return new Date(e,11,26)}function c(e){return new Date(e,11,25)}function l(e){return new Date(e,11,24)}function u(n){return(0,e.addWeeks)(t(new Date(n,9),1),1)}function d(e){if(e<325)throw RangeError(`Cannot calculate Easter dates before 325 AD.`);function t(e,t){return e%t}function n(e,t){let n=e/t;if(n<0)throw Error(`Unexpected negative q`);return Math.floor(n)}let r=e,i=t(r,19),a=n(r,100),o=t(r,100),s=n(a,4),c=t(a,4),l=n(a-n(a+8,25)+1,3),u=t(19*i+a-s-l+15,30),d=n(o,4),f=t(o,4),p=t(32+2*c+2*d-u-f,7),m=n(i+11*u+22*p,451),h=u+p-7*m+21,g=n(h,31)+3,_=t(h,31);return new Date(e,g-1,_+1)}function f(n){return(0,e.addWeeks)(t(new Date(n,5),0),2)}function p(t){return(0,e.addDays)(d(t),-2)}function m(e){return new Date(e,9,31)}function h(e){return new Date(e,6,4)}function g(e){return new Date(e,5,19)}function _(e){return t(new Date(e,8),1)}function v(n){return(0,e.addWeeks)(t(new Date(n,0),1),2)}function y(e){return i(new Date(e,4),1)}function b(n){return(0,e.addWeeks)(t(new Date(n,4),0),1)}function x(e){return new Date(e,0,1)}function S(t){return(0,e.lastDayOfMonth)(new Date(t,11))}function C(n){return(0,e.addWeeks)(t(new Date(n,1),1),2)}function w(e){return new Date(e,2,17)}function T(e){return new Date(e,1,14)}function E(e){return new Date(e,10,11)}function D(e,t){let n={};for(let[r,i]of Object.entries(A(e)))t(i)&&(n[r]={date:i.date});return n}function O(e){return D(e,e=>e.bankHoliday)}function k(e){return D(e,e=>e.federal)}function A(e){return{blackFriday:{date:o(e),bankHoliday:!1,federal:!1},boxingDay:{date:s(e),bankHoliday:!1,federal:!1},christmas:{date:c(e),bankHoliday:!0,federal:!0},christmasEve:{date:l(e),bankHoliday:!1,federal:!1},columbusDay:{date:u(e),bankHoliday:!0,federal:!0},easter:{date:d(e),bankHoliday:!1,federal:!1},fathersDay:{date:f(e),bankHoliday:!1,federal:!1},goodFriday:{date:p(e),bankHoliday:!1,federal:!1},halloween:{date:m(e),bankHoliday:!1,federal:!1},independenceDay:{date:h(e),bankHoliday:!0,federal:!0},juneteenth:{date:g(e),bankHoliday:!(e<2022),federal:!0},laborDay:{date:_(e),bankHoliday:!0,federal:!0},martinLutherKingJrDay:{date:v(e),bankHoliday:!0,federal:!0},memorialDay:{date:y(e),bankHoliday:!0,federal:!0},mothersDay:{date:b(e),bankHoliday:!1,federal:!1},newYearsDay:{date:x(e),bankHoliday:!0,federal:!0},newYearsEve:{date:S(e),bankHoliday:!1,federal:!1},presidentsDay:{date:C(e),bankHoliday:!0,federal:!1},stPatricksDay:{date:w(e),bankHoliday:!1,federal:!1},thanksgiving:{date:a(e),bankHoliday:!0,federal:!0},valentinesDay:{date:T(e),bankHoliday:!1,federal:!1},veteransDay:{date:E(e),bankHoliday:!0,federal:!0}}}function j(t){let n={};for(let[r,i]of Object.entries(A(t)))i.federal&&((0,e.isSaturday)(i.date)?n[r]={date:(0,e.addDays)(i.date,-1)}:(0,e.isSunday)(i.date)&&(n[r]={date:(0,e.addDays)(i.date,1)}));return n}function M(t,n){let r=n((0,e.getYear)(t));return Object.values(r).some(n=>(0,e.isSameDay)(t,n.date))}function N(e){return M(e,A)}function P(e){return M(e,k)}function F(e){return M(e,O)}exports.filterHolidays=D,exports.getBankHolidays=O,exports.getBlackFriday=o,exports.getBoxingDay=s,exports.getChristmas=c,exports.getChristmasEve=l,exports.getColumbusDay=u,exports.getEaster=d,exports.getFathersDay=f,exports.getFederalHolidays=k,exports.getFirstOccurrence=t,exports.getGoodFriday=p,exports.getHalloween=m,exports.getHolidays=A,exports.getIndependenceDay=h,exports.getJuneteenth=g,exports.getLaborDay=_,exports.getLastOfMonth=i,exports.getMartinLutherKingJrDay=v,exports.getMemorialDay=y,exports.getMothersDay=b,exports.getNewYearsDay=x,exports.getNewYearsEve=S,exports.getNextOccurrence=n,exports.getObservedHolidays=j,exports.getPresidentsDay=C,exports.getPrevOccurrence=r,exports.getStPatricksDay=w,exports.getThanksgiving=a,exports.getValentinesDay=T,exports.getVeteransDay=E,exports.isBankHoliday=F,exports.isFederalHoliday=P,exports.isHoliday=N,exports.isInHolidayList=M;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("date-fns");function t(t,r){return n((0,e.setDate)(t,1),r)}function n(t,n){return(0,e.getDay)(t)===n||(t=(0,e.getDay)(t)>n?(0,e.addDays)(t,7-(0,e.getDay)(t)+n):(0,e.addDays)(t,n-(0,e.getDay)(t))),t}function r(t,n){return(0,e.getDay)(t)===n||(t=(0,e.getDay)(t)>n?(0,e.addDays)(t,-1*((0,e.getDay)(t)-n)):(0,e.addDays)(t,-1*((0,e.getDay)(t)-0+(7-n)))),t}function i(t,n){return r((0,e.lastDayOfMonth)(t),n)}function a(n){return(0,e.addWeeks)(t(new Date(n,10),4),3)}function o(t){return(0,e.addDays)(a(t),1)}function s(e){return new Date(e,11,26)}function c(e){return new Date(e,11,25)}function l(e){return c(e)}function u(e){return new Date(e,11,24)}function d(n){return(0,e.addWeeks)(t(new Date(n,9),1),1)}function f(e){if(e<325)throw RangeError(`Cannot calculate Easter dates before 325 AD.`);function t(e,t){return e%t}function n(e,t){let n=e/t;if(n<0)throw Error(`Unexpected negative q`);return Math.floor(n)}let r=e,i=t(r,19),a=n(r,100),o=t(r,100),s=n(a,4),c=t(a,4),l=n(a-n(a+8,25)+1,3),u=t(19*i+a-s-l+15,30),d=n(o,4),f=t(o,4),p=t(32+2*c+2*d-u-f,7),m=n(i+11*u+22*p,451),h=u+p-7*m+21,g=n(h,31)+3,_=t(h,31);return new Date(e,g-1,_+1)}function p(n){return(0,e.addWeeks)(t(new Date(n,5),0),2)}function m(t){return(0,e.addDays)(f(t),-2)}function h(e){return new Date(e,9,31)}function g(e){return new Date(e,6,4)}function _(e){return new Date(e,5,19)}function v(e){return t(new Date(e,8),1)}function y(n){return(0,e.addWeeks)(t(new Date(n,0),1),2)}function b(e){return i(new Date(e,4),1)}function x(n){return(0,e.addWeeks)(t(new Date(n,4),0),1)}function S(e){return new Date(e,0,1)}function C(t){return(0,e.lastDayOfMonth)(new Date(t,11))}function w(n){return(0,e.addWeeks)(t(new Date(n,1),1),2)}function T(e){return new Date(e,2,17)}function E(e){return new Date(e,1,14)}function D(e){return new Date(e,10,11)}function O(e,t){let n={};for(let[r,i]of Object.entries(j(e)))t(i)&&(n[r]={date:i.date});return n}function k(e){return O(e,e=>e.bankHoliday)}function A(e){return O(e,e=>e.federal)}function j(e){return{blackFriday:{date:o(e),bankHoliday:!1,federal:!1},boxingDay:{date:s(e),bankHoliday:!1,federal:!1},christmas:{date:l(e),bankHoliday:!0,federal:!0},christmasDay:{date:c(e),bankHoliday:!0,federal:!0},christmasEve:{date:u(e),bankHoliday:!1,federal:!1},columbusDay:{date:d(e),bankHoliday:!0,federal:!0},easter:{date:f(e),bankHoliday:!1,federal:!1},fathersDay:{date:p(e),bankHoliday:!1,federal:!1},goodFriday:{date:m(e),bankHoliday:!1,federal:!1},halloween:{date:h(e),bankHoliday:!1,federal:!1},independenceDay:{date:g(e),bankHoliday:!0,federal:!0},juneteenth:{date:_(e),bankHoliday:!(e<2022),federal:!0},laborDay:{date:v(e),bankHoliday:!0,federal:!0},martinLutherKingJrDay:{date:y(e),bankHoliday:!0,federal:!0},memorialDay:{date:b(e),bankHoliday:!0,federal:!0},mothersDay:{date:x(e),bankHoliday:!1,federal:!1},newYearsDay:{date:S(e),bankHoliday:!0,federal:!0},newYearsEve:{date:C(e),bankHoliday:!1,federal:!1},presidentsDay:{date:w(e),bankHoliday:!0,federal:!1},stPatricksDay:{date:T(e),bankHoliday:!1,federal:!1},thanksgiving:{date:a(e),bankHoliday:!0,federal:!0},valentinesDay:{date:E(e),bankHoliday:!1,federal:!1},veteransDay:{date:D(e),bankHoliday:!0,federal:!0}}}function M(t){let n={};for(let[r,i]of Object.entries(j(t)))i.federal&&((0,e.isSaturday)(i.date)?n[r]={date:(0,e.addDays)(i.date,-1)}:(0,e.isSunday)(i.date)&&(n[r]={date:(0,e.addDays)(i.date,1)}));return n}function N(t,n){let r=n((0,e.getYear)(t));return Object.values(r).some(n=>(0,e.isSameDay)(t,n.date))}function P(e){return N(e,j)}function F(e){return N(e,A)}function I(e){return N(e,k)}exports.filterHolidays=O,exports.getBankHolidays=k,exports.getBlackFriday=o,exports.getBoxingDay=s,exports.getChristmas=l,exports.getChristmasDay=c,exports.getChristmasEve=u,exports.getColumbusDay=d,exports.getEaster=f,exports.getFathersDay=p,exports.getFederalHolidays=A,exports.getFirstOccurrence=t,exports.getGoodFriday=m,exports.getHalloween=h,exports.getHolidays=j,exports.getIndependenceDay=g,exports.getJuneteenth=_,exports.getLaborDay=v,exports.getLastOfMonth=i,exports.getMartinLutherKingJrDay=y,exports.getMemorialDay=b,exports.getMothersDay=x,exports.getNewYearsDay=S,exports.getNewYearsEve=C,exports.getNextOccurrence=n,exports.getObservedHolidays=M,exports.getPresidentsDay=w,exports.getPrevOccurrence=r,exports.getStPatricksDay=T,exports.getThanksgiving=a,exports.getValentinesDay=E,exports.getVeteransDay=D,exports.isBankHoliday=I,exports.isFederalHoliday=F,exports.isHoliday=P,exports.isInHolidayList=N;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/utils/getters.ts","../src/holiday/getThanksgiving.ts","../src/holiday/getBlackFriday.ts","../src/holiday/getBoxingDay.ts","../src/holiday/getChristmas.ts","../src/holiday/getChristmasEve.ts","../src/holiday/getColumbusDay.ts","../src/holiday/getEaster.ts","../src/holiday/getFathersDay.ts","../src/holiday/getGoodFriday.ts","../src/holiday/getHalloween.ts","../src/holiday/getIndependenceDay.ts","../src/holiday/getJuneteenth.ts","../src/holiday/getLaborDay.ts","../src/holiday/getMartinLutherKingJrDay.ts","../src/holiday/getMemorialDay.ts","../src/holiday/getMothersDay.ts","../src/holiday/getNewYearsDay.ts","../src/holiday/getNewYearsEve.ts","../src/holiday/getPresidentsDay.ts","../src/holiday/getStPatricksDay.ts","../src/holiday/getValentinesDay.ts","../src/holiday/getVeteransDay.ts","../src/utils/filters.ts","../src/holidays/getBankHolidays.ts","../src/holidays/getFederalHolidays.ts","../src/holidays/getHolidays.ts","../src/holidays/getObservedHolidays.ts","../src/utils/isIn.ts"],"sourcesContent":["import {\n addDays,\n getDay as getDayOfWeek,\n lastDayOfMonth,\n setDate as setDayOfMonth,\n} from \"date-fns\";\n\n/**\n * Returns the first occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This works by normalizing the date to the first day of its month, then finding the\n * next occurrence of the specified weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the first occurrence of the weekday in that month.\n */\nexport function getFirstOccurrence(date: Date, dayOfWeekIndex: number) {\n return getNextOccurrence(setDayOfMonth(date, 1), dayOfWeekIndex);\n}\n\n/**\n * Returns the next occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function advances forward to the next matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the next occurrence of the weekday.\n */\nexport function getNextOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, 7 - getDayOfWeek(date) + dayOfWeekIndex);\n } else {\n date = addDays(date, dayOfWeekIndex - getDayOfWeek(date));\n }\n return date;\n}\n\n/**\n * Returns the previous occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function moves backward to the previous matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the previous occurrence of the weekday.\n */\nexport function getPrevOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, -1 * (getDayOfWeek(date) - dayOfWeekIndex));\n } else {\n date = addDays(date, -1 * (getDayOfWeek(date) - 0 + (7 - dayOfWeekIndex)));\n }\n return date;\n}\n\n/**\n * Returns the last occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This is computed by starting at the last day of the month and walking backwards\n * to the requested weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the last occurrence of the weekday in the month.\n */\nexport function getLastOfMonth(date: Date, dayOfWeekIndex: number) {\n return getPrevOccurrence(lastDayOfMonth(date), dayOfWeekIndex);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Thanksgiving for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Thanksgiving is observed on the fourth Thursday of November.\n *\n * @param year - The year for which to calculate Thanksgiving.\n * @returns A {@link Date} representing Thanksgiving in the specified year.\n */\nexport function getThanksgiving(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 10), 4), 3);\n}\n","import { addDays } from \"date-fns\";\nimport { getThanksgiving } from \"./getThanksgiving\";\n\n/**\n * Returns the date of Black Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Black Friday is observed annually on the day after Thanksgiving Day\n * in the United States (the fourth Friday of November).\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Black Friday.\n * @returns A {@link Date} representing Black Friday of the specified year.\n */\nexport function getBlackFriday(year: number) {\n return addDays(getThanksgiving(year), 1);\n}\n","/**\n * Returns the date of Boxing Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Boxing Day is observed on December 26 in several Commonwealth countries,\n * including the UK, Canada, Australia, and New Zealand.\n *\n * It is not a U.S. federal holiday, but it is a fixed calendar date\n * immediately following Christmas Day.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Boxing Day.\n * @returns A {@link Date} representing December 26 of the specified year.\n */\nexport function getBoxingDay(year: number) {\n return new Date(year, 11, 26);\n}\n","/**\n * Returns the date of Christmas Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Day is observed annually on December 25.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Day.\n * @returns A {@link Date} representing December 25 of the specified year.\n */\nexport function getChristmas(year: number) {\n return new Date(year, 11, 25);\n}\n","/**\n * Returns the date of Christmas Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Eve is observed annually on December 24.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Eve.\n * @returns A {@link Date} representing December 24 of the specified year.\n */\nexport function getChristmasEve(year: number) {\n return new Date(year, 11, 24);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Columbus Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Columbus Day is observed on the second Monday\n * of October.\n *\n * @param year - The year for which to calculate Columbus Day.\n * @returns A {@link Date} representing the second Monday in October.\n */\nexport function getColumbusDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 9), 1), 1);\n}\n","/**\n * Calculates the date of Easter Sunday for a given year using the\n * Gregorian computus algorithm.\n *\n * @category Holiday\n *\n * @remarks\n * This implementation is valid for years from 325 AD onward, the year of the\n * First Council of Nicaea, which established the basis for calculating Easter.\n *\n * The returned {@link Date} is created in the local time zone and represents\n * Easter Sunday for the specified year.\n *\n * @param year - The year for which to calculate Easter Sunday.\n * @returns A {@link Date} representing Easter Sunday in the specified year.\n * @throws {RangeError} Thrown if the year is earlier than 325 AD.\n */\nexport function getEaster(year: number) {\n if (year < 325) {\n throw new RangeError(\"Cannot calculate Easter dates before 325 AD.\");\n }\n\n /**\n * Computes the remainder of a division operation.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The remainder of `a / b`.\n */\n function mod(a: number, b: number) {\n return a % b;\n }\n\n /**\n * Performs integer division by truncating toward negative infinity.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The integer quotient of `a / b`.\n * @throws {Error} Thrown if an unexpected negative quotient is produced.\n */\n function div(a: number, b: number) {\n const q = a / b;\n /* v8 ignore next */\n if (q < 0) {\n throw new Error(\"Unexpected negative q\");\n }\n return Math.floor(q);\n }\n\n const y = year,\n skipMarchDays = 21,\n a = mod(y, 19),\n b = div(y, 100),\n c = mod(y, 100),\n d = div(b, 4),\n e = mod(b, 4),\n f = div(b + 8, 25),\n g = div(b - f + 1, 3),\n h = mod(19 * a + b - d - g + 15, 30),\n i = div(c, 4),\n k = mod(c, 4),\n l = mod(32 + 2 * e + 2 * i - h - k, 7),\n m = div(a + 11 * h + 22 * l, 451),\n t = h + l - 7 * m + skipMarchDays,\n n = div(t, 31) + 3,\n p = mod(t, 31);\n\n return new Date(year, n - 1, p + 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Father's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States and many other countries, Father's Day is observed on\n * the third Sunday of June.\n *\n * @param year - The year for which to calculate Father's Day.\n * @returns A {@link Date} representing the third Sunday in June.\n */\nexport function getFathersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 5), 0), 2);\n}\n","import { addDays } from \"date-fns\";\nimport { getEaster } from \"./getEaster\";\n\n/**\n * Calculates the date of Good Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Good Friday is observed two days before Easter Sunday and commemorates the\n * crucifixion of Jesus Christ in Christian tradition.\n *\n * @param year - The year for which to calculate Good Friday.\n * @returns A {@link Date} representing Good Friday in the specified year.\n */\nexport function getGoodFriday(year: number) {\n return addDays(getEaster(year), -2);\n}\n","/**\n * Returns the date of Halloween for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Halloween is observed annually on October 31.\n *\n * @param year - The year for which to obtain Halloween.\n * @returns A {@link Date} representing October 31 of the specified year.\n */\nexport function getHalloween(year: number) {\n return new Date(year, 9, 31);\n}\n","/**\n * Returns the date of Independence Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Independence Day in the United States is observed annually on July 4.\n *\n * @param year - The year for which to obtain Independence Day.\n * @returns A {@link Date} representing July 4 of the specified year.\n */\nexport function getIndependenceDay(year: number) {\n return new Date(year, 6, 4);\n}\n","/**\n * Returns the date of Juneteenth for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Juneteenth National Independence Day is observed in the United States on June 19.\n * It became a federal holiday in 2021.\n *\n * @param year - The year for which to obtain Juneteenth.\n * @returns A {@link Date} representing June 19 of the specified year.\n */\nexport function getJuneteenth(year: number) {\n return new Date(year, 5, 19);\n}\n","import { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Labor Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Labor Day is observed on the first Monday of September.\n *\n * @param year - The year for which to calculate Labor Day.\n * @returns A {@link Date} representing Labor Day in the specified year.\n */\nexport function getLaborDay(year: number) {\n return getFirstOccurrence(new Date(year, 8), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Martin Luther King Jr. Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Martin Luther King Jr. Day is observed on the third Monday of January.\n *\n * @param year - The year for which to calculate the holiday.\n * @returns A {@link Date} representing Martin Luther King Jr. Day in the specified year.\n */\nexport function getMartinLutherKingJrDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 0), 1), 2);\n}\n","import { getLastOfMonth } from \"../utils/getters\";\n\n/**\n * Returns the date of Memorial Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Memorial Day is observed on the last Monday of May.\n *\n * @param year - The year for which to calculate Memorial Day.\n * @returns A {@link Date} representing Memorial Day in the specified year.\n */\nexport function getMemorialDay(year: number) {\n return getLastOfMonth(new Date(year, 4), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Mother's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Mother's Day is observed on the second Sunday of May.\n *\n * @param year - The year for which to calculate Mother's Day.\n * @returns A {@link Date} representing Mother's Day in the specified year.\n */\nexport function getMothersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 4), 0), 1);\n}\n","/**\n * Returns the date of New Year's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Day is observed annually on January 1.\n *\n * @param year - The year for which to obtain New Year's Day.\n * @returns A {@link Date} representing January 1 of the specified year.\n */\nexport function getNewYearsDay(year: number) {\n return new Date(year, 0, 1);\n}\n","import { lastDayOfMonth } from \"date-fns\";\n\n/**\n * Returns the date of New Year's Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Eve is the last day of the year, observed on December 31.\n *\n * @param year - The year for which to obtain New Year's Eve.\n * @returns A {@link Date} representing December 31 of the specified year.\n */\nexport function getNewYearsEve(year: number) {\n return lastDayOfMonth(new Date(year, 11));\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Presidents Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Presidents Day is observed on the third Monday of February.\n *\n * @param year - The year for which to calculate Presidents Day.\n * @returns A {@link Date} representing Presidents Day in the specified year.\n */\nexport function getPresidentsDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 1), 1), 2);\n}\n","/**\n * Returns the date of St. Patrick's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * St. Patrick's Day is observed annually on March 17.\n *\n * It is not a U.S. federal holiday, but is widely celebrated culturally,\n * particularly in the United States and Ireland.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain St. Patrick's Day.\n * @returns A {@link Date} representing March 17 of the specified year.\n */\nexport function getStPatricksDay(year: number) {\n return new Date(year, 2, 17);\n}\n","/**\n * Returns the date of Valentine's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Valentine's Day is observed annually on February 14.\n *\n * @param year - The year for which to obtain Valentine's Day.\n * @returns A {@link Date} representing February 14 of the specified year.\n */\nexport function getValentinesDay(year: number) {\n return new Date(year, 1, 14);\n}\n","/**\n * Returns the date of Veterans Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Veterans Day is observed annually on November 11 in the United States.\n *\n * @param year - The year for which to obtain Veterans Day.\n * @returns A {@link Date} representing November 11 of the specified year.\n */\nexport function getVeteransDay(year: number) {\n return new Date(year, 10, 11);\n}\n","import { getHolidays } from \"../holidays\";\nimport type { Holiday, HolidayList, Holidays } from \"../types\";\n\n/**\n * Filters the full holiday set for a given year using a predicate.\n *\n * @category Utility\n *\n * @remarks\n * This function evaluates the complete {@link Holidays} object returned by\n * {@link getHolidays} and constructs a {@link HolidayList} containing only\n * entries that satisfy the provided predicate.\n *\n * The resulting object preserves the original holiday keys but reduces each\n * entry to its date value.\n *\n * @param year - The year for which to retrieve and filter holidays.\n * @param predicate - Function applied to each holiday entry to determine inclusion.\n * @returns A {@link HolidayList} containing only matching holidays.\n */\nexport function filterHolidays(\n year: number,\n predicate: (holiday: Holidays[Holiday]) => boolean,\n): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (predicate(holiday)) {\n result[name] = {\n date: holiday.date,\n };\n }\n }\n\n return result;\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all bank holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as bank holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve bank holidays.\n * @returns A {@link HolidayList} of bank holidays occurring in the specified year.\n */\nexport function getBankHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.bankHoliday);\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as federal holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve federal holidays.\n * @returns A {@link HolidayList} of federal holidays occurring in the specified year.\n */\nexport function getFederalHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.federal);\n}\n","import { getBlackFriday } from \"../holiday/getBlackFriday\";\nimport { getBoxingDay } from \"../holiday/getBoxingDay\";\nimport { getChristmas } from \"../holiday/getChristmas\";\nimport { getChristmasEve } from \"../holiday/getChristmasEve\";\nimport { getColumbusDay } from \"../holiday/getColumbusDay\";\nimport { getEaster } from \"../holiday/getEaster\";\nimport { getFathersDay } from \"../holiday/getFathersDay\";\nimport { getGoodFriday } from \"../holiday/getGoodFriday\";\nimport { getHalloween } from \"../holiday/getHalloween\";\nimport { getIndependenceDay } from \"../holiday/getIndependenceDay\";\nimport { getJuneteenth } from \"../holiday/getJuneteenth\";\nimport { getLaborDay } from \"../holiday/getLaborDay\";\nimport { getMartinLutherKingJrDay } from \"../holiday/getMartinLutherKingJrDay\";\nimport { getMemorialDay } from \"../holiday/getMemorialDay\";\nimport { getMothersDay } from \"../holiday/getMothersDay\";\nimport { getNewYearsDay } from \"../holiday/getNewYearsDay\";\nimport { getNewYearsEve } from \"../holiday/getNewYearsEve\";\nimport { getPresidentsDay } from \"../holiday/getPresidentsDay\";\nimport { getStPatricksDay } from \"../holiday/getStPatricksDay\";\nimport { getThanksgiving } from \"../holiday/getThanksgiving\";\nimport { getValentinesDay } from \"../holiday/getValentinesDay\";\nimport { getVeteransDay } from \"../holiday/getVeteransDay\";\nimport type { Holidays } from \"../types\";\n\n/**\n * Returns the complete set of supported holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Each holiday entry contains its calculated date together with metadata\n * indicating whether it is recognized as a federal holiday and/or a bank\n * holiday.\n *\n * Holiday observance classifications may vary by jurisdiction and may change\n * over time. The values returned by this function reflect the rules implemented\n * by this library.\n *\n * @param year - The year for which to generate holiday information.\n * @returns An object containing all supported holidays and their metadata.\n */\nexport function getHolidays(year: number): Holidays {\n return {\n blackFriday: {\n date: getBlackFriday(year),\n bankHoliday: false,\n federal: false,\n },\n boxingDay: {\n date: getBoxingDay(year),\n bankHoliday: false,\n federal: false,\n },\n christmas: {\n date: getChristmas(year),\n bankHoliday: true,\n federal: true,\n },\n christmasEve: {\n date: getChristmasEve(year),\n bankHoliday: false,\n federal: false,\n },\n columbusDay: {\n date: getColumbusDay(year),\n bankHoliday: true,\n federal: true,\n },\n easter: {\n date: getEaster(year),\n bankHoliday: false,\n federal: false,\n },\n fathersDay: {\n date: getFathersDay(year),\n bankHoliday: false,\n federal: false,\n },\n goodFriday: {\n date: getGoodFriday(year),\n bankHoliday: false,\n federal: false,\n },\n halloween: {\n date: getHalloween(year),\n bankHoliday: false,\n federal: false,\n },\n independenceDay: {\n date: getIndependenceDay(year),\n bankHoliday: true,\n federal: true,\n },\n juneteenth: {\n date: getJuneteenth(year),\n bankHoliday: !(year < 2022),\n federal: true,\n },\n laborDay: {\n date: getLaborDay(year),\n bankHoliday: true,\n federal: true,\n },\n martinLutherKingJrDay: {\n date: getMartinLutherKingJrDay(year),\n bankHoliday: true,\n federal: true,\n },\n memorialDay: {\n date: getMemorialDay(year),\n bankHoliday: true,\n federal: true,\n },\n mothersDay: {\n date: getMothersDay(year),\n bankHoliday: false,\n federal: false,\n },\n newYearsDay: {\n date: getNewYearsDay(year),\n bankHoliday: true,\n federal: true,\n },\n newYearsEve: {\n date: getNewYearsEve(year),\n bankHoliday: false,\n federal: false,\n },\n presidentsDay: {\n date: getPresidentsDay(year),\n bankHoliday: true,\n federal: false,\n },\n stPatricksDay: {\n date: getStPatricksDay(year),\n bankHoliday: false,\n federal: false,\n },\n thanksgiving: {\n date: getThanksgiving(year),\n bankHoliday: true,\n federal: true,\n },\n valentinesDay: {\n date: getValentinesDay(year),\n bankHoliday: false,\n federal: false,\n },\n veteransDay: {\n date: getVeteransDay(year),\n bankHoliday: true,\n federal: true,\n },\n };\n}\n","import { addDays, isSaturday, isSunday } from \"date-fns\";\nimport type { HolidayList } from \"../types\";\nimport { getHolidays } from \"./getHolidays\";\n\n/**\n * Returns the observed federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * This function adjusts federal holidays that fall on weekends to their\n * observed dates:\n * - Saturday holidays are observed on the preceding Friday\n * - Sunday holidays are observed on the following Monday\n *\n * Only holidays marked as `federal: true` are included in the result.\n *\n * @param year - The year for which to calculate observed holidays.\n * @returns A {@link HolidayList} containing observed federal holiday dates.\n */\nexport function getObservedHolidays(year: number): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (!holiday.federal) {\n continue;\n }\n\n if (isSaturday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, -1),\n };\n } else if (isSunday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, 1),\n };\n }\n }\n\n return result;\n}\n","import { getYear, isSameDay } from \"date-fns\";\nimport { getBankHolidays } from \"../holidays/getBankHolidays\";\nimport { getFederalHolidays } from \"../holidays/getFederalHolidays\";\nimport { getHolidays } from \"../holidays/getHolidays\";\nimport type { HolidayList } from \"../types\";\n\n/**\n * Determines whether a given {@link Date} exists within a {@link HolidayList} for its year.\n *\n * @category Utility\n *\n * @remarks\n * The function resolves the appropriate holiday list for the year of the provided\n * {@link Date}, then checks whether any holiday in that list matches the given date\n * using calendar-day comparison (time components are ignored).\n *\n * @param date - The {@link Date} to evaluate.\n * @param getHolidayList - Function that returns a {@link HolidayList} for a given year.\n * @returns `true` if the {@link Date} matches any entry in the holiday list; otherwise `false`.\n */\nexport function isInHolidayList(\n date: Date,\n getHolidayList: (year: number) => HolidayList,\n): boolean {\n const holidays = getHolidayList(getYear(date));\n\n return Object.values(holidays).some((holiday) =>\n isSameDay(date, holiday.date),\n );\n}\n\n/**\n * Checks whether a {@link Date} is any recognized holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a holiday.\n */\nexport function isHoliday(date: Date): boolean {\n return isInHolidayList(date, getHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a federal holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a federal holiday.\n */\nexport function isFederalHoliday(date: Date): boolean {\n return isInHolidayList(date, getFederalHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a bank holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a bank holiday.\n */\nexport function isBankHoliday(date: Date): boolean {\n return isInHolidayList(date, getBankHolidays);\n}\n"],"mappings":"6FAoBA,SAAgB,EAAmB,EAAY,EAAwB,CACrE,OAAO,GAAA,EAAA,EAAA,QAAA,CAAgC,EAAM,CAAC,EAAG,CAAc,CACjE,CAeA,SAAgB,EAAkB,EAAY,EAAwB,CAUpE,OATA,EAAA,EAAA,OAAA,CAAiB,CAAI,IAAM,IAI3B,AAGE,GAHF,EAAA,EAAA,OAAA,CAAiB,CAAI,EAAI,GACvB,EAAA,EAAA,QAAA,CAAe,EAAM,GAAA,EAAA,EAAA,OAAA,CAAiB,CAAI,EAAI,CAAc,GAE5D,EAAA,EAAA,QAAA,CAAe,EAAM,GAAA,EAAA,EAAA,OAAA,CAA8B,CAAI,CAAC,GANjD,CASX,CAeA,SAAgB,EAAkB,EAAY,EAAwB,CAUpE,OATA,EAAA,EAAA,OAAA,CAAiB,CAAI,IAAM,IAI3B,AAGE,GAHF,EAAA,EAAA,OAAA,CAAiB,CAAI,EAAI,GACvB,EAAA,EAAA,QAAA,CAAe,EAAM,KAAA,EAAA,EAAA,OAAA,CAAmB,CAAI,EAAI,EAAe,GAE/D,EAAA,EAAA,QAAA,CAAe,EAAM,KAAA,EAAA,EAAA,OAAA,CAAmB,CAAI,EAAI,GAAK,EAAI,GAAgB,GANlE,CASX,CAeA,SAAgB,EAAe,EAAY,EAAwB,CACjE,OAAO,GAAA,EAAA,EAAA,eAAA,CAAiC,CAAI,EAAG,CAAc,CAC/D,CC7EA,SAAgB,EAAgB,EAAc,CAC5C,OAAA,EAAA,EAAA,SAAA,CAAgB,EAAmB,IAAI,KAAK,EAAM,EAAE,EAAG,CAAC,EAAG,CAAC,CAC9D,CCCA,SAAgB,EAAe,EAAc,CAC3C,OAAA,EAAA,EAAA,QAAA,CAAe,EAAgB,CAAI,EAAG,CAAC,CACzC,CCFA,SAAgB,EAAa,EAAc,CACzC,OAAO,IAAI,KAAK,EAAM,G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AAM,IAAA,EAAA,EAAA,UAAA,CACzB,EAAM,EAAQ,IAAI,CAC9B,CACF,CAUA,SAAgB,EAAU,EAAqB,CAC7C,OAAO,EAAgB,EAAM,CAAW,CAC1C,CAUA,SAAgB,EAAiB,EAAqB,CACpD,OAAO,EAAgB,EAAM,CAAkB,CACjD,CAUA,SAAgB,EAAc,EAAqB,CACjD,OAAO,EAAgB,EAAM,CAAe,CAC9C"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/utils/getters.ts","../src/holiday/getThanksgiving.ts","../src/holiday/getBlackFriday.ts","../src/holiday/getBoxingDay.ts","../src/holiday/getChristmasDay.ts","../src/holiday/getChristmas.ts","../src/holiday/getChristmasEve.ts","../src/holiday/getColumbusDay.ts","../src/holiday/getEaster.ts","../src/holiday/getFathersDay.ts","../src/holiday/getGoodFriday.ts","../src/holiday/getHalloween.ts","../src/holiday/getIndependenceDay.ts","../src/holiday/getJuneteenth.ts","../src/holiday/getLaborDay.ts","../src/holiday/getMartinLutherKingJrDay.ts","../src/holiday/getMemorialDay.ts","../src/holiday/getMothersDay.ts","../src/holiday/getNewYearsDay.ts","../src/holiday/getNewYearsEve.ts","../src/holiday/getPresidentsDay.ts","../src/holiday/getStPatricksDay.ts","../src/holiday/getValentinesDay.ts","../src/holiday/getVeteransDay.ts","../src/utils/filters.ts","../src/holidays/getBankHolidays.ts","../src/holidays/getFederalHolidays.ts","../src/holidays/getHolidays.ts","../src/holidays/getObservedHolidays.ts","../src/utils/isIn.ts"],"sourcesContent":["import {\n addDays,\n getDay as getDayOfWeek,\n lastDayOfMonth,\n setDate as setDayOfMonth,\n} from \"date-fns\";\n\n/**\n * Returns the first occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This works by normalizing the date to the first day of its month, then finding the\n * next occurrence of the specified weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the first occurrence of the weekday in that month.\n */\nexport function getFirstOccurrence(date: Date, dayOfWeekIndex: number) {\n return getNextOccurrence(setDayOfMonth(date, 1), dayOfWeekIndex);\n}\n\n/**\n * Returns the next occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function advances forward to the next matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the next occurrence of the weekday.\n */\nexport function getNextOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, 7 - getDayOfWeek(date) + dayOfWeekIndex);\n } else {\n date = addDays(date, dayOfWeekIndex - getDayOfWeek(date));\n }\n return date;\n}\n\n/**\n * Returns the previous occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function moves backward to the previous matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the previous occurrence of the weekday.\n */\nexport function getPrevOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, -1 * (getDayOfWeek(date) - dayOfWeekIndex));\n } else {\n date = addDays(date, -1 * (getDayOfWeek(date) - 0 + (7 - dayOfWeekIndex)));\n }\n return date;\n}\n\n/**\n * Returns the last occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This is computed by starting at the last day of the month and walking backwards\n * to the requested weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the last occurrence of the weekday in the month.\n */\nexport function getLastOfMonth(date: Date, dayOfWeekIndex: number) {\n return getPrevOccurrence(lastDayOfMonth(date), dayOfWeekIndex);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Thanksgiving for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Thanksgiving is observed on the fourth Thursday of November.\n *\n * @param year - The year for which to calculate Thanksgiving.\n * @returns A {@link Date} representing Thanksgiving in the specified year.\n */\nexport function getThanksgiving(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 10), 4), 3);\n}\n","import { addDays } from \"date-fns\";\nimport { getThanksgiving } from \"./getThanksgiving\";\n\n/**\n * Returns the date of Black Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Black Friday is observed annually on the day after Thanksgiving Day\n * in the United States (the fourth Friday of November).\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Black Friday.\n * @returns A {@link Date} representing Black Friday of the specified year.\n */\nexport function getBlackFriday(year: number) {\n return addDays(getThanksgiving(year), 1);\n}\n","/**\n * Returns the date of Boxing Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Boxing Day is observed on December 26 in several Commonwealth countries,\n * including the UK, Canada, Australia, and New Zealand.\n *\n * It is not a U.S. federal holiday, but it is a fixed calendar date\n * immediately following Christmas Day.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Boxing Day.\n * @returns A {@link Date} representing December 26 of the specified year.\n */\nexport function getBoxingDay(year: number) {\n return new Date(year, 11, 26);\n}\n","/**\n * Returns the date of Christmas Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Day is observed annually on December 25.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Day.\n * @returns A {@link Date} representing December 25 of the specified year.\n */\nexport function getChristmasDay(year: number) {\n return new Date(year, 11, 25);\n}\n","import { getChristmasDay } from \"./getChristmasDay\";\n\n/**\n * @deprecated Use {@link getChristmasDay} instead.\n *\n * @category Holiday\n *\n * @param year - The year for which to obtain Christmas Day.\n * @returns A {@link Date} representing December 25 of the specified year.\n */\nexport function getChristmas(year: number) {\n return getChristmasDay(year);\n}\n","/**\n * Returns the date of Christmas Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Eve is observed annually on December 24.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Eve.\n * @returns A {@link Date} representing December 24 of the specified year.\n */\nexport function getChristmasEve(year: number) {\n return new Date(year, 11, 24);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Columbus Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Columbus Day is observed on the second Monday\n * of October.\n *\n * @param year - The year for which to calculate Columbus Day.\n * @returns A {@link Date} representing the second Monday in October.\n */\nexport function getColumbusDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 9), 1), 1);\n}\n","/**\n * Calculates the date of Easter Sunday for a given year using the\n * Gregorian computus algorithm.\n *\n * @category Holiday\n *\n * @remarks\n * This implementation is valid for years from 325 AD onward, the year of the\n * First Council of Nicaea, which established the basis for calculating Easter.\n *\n * The returned {@link Date} is created in the local time zone and represents\n * Easter Sunday for the specified year.\n *\n * @param year - The year for which to calculate Easter Sunday.\n * @returns A {@link Date} representing Easter Sunday in the specified year.\n * @throws {RangeError} Thrown if the year is earlier than 325 AD.\n */\nexport function getEaster(year: number) {\n if (year < 325) {\n throw new RangeError(\"Cannot calculate Easter dates before 325 AD.\");\n }\n\n /**\n * Computes the remainder of a division operation.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The remainder of `a / b`.\n */\n function mod(a: number, b: number) {\n return a % b;\n }\n\n /**\n * Performs integer division by truncating toward negative infinity.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The integer quotient of `a / b`.\n * @throws {Error} Thrown if an unexpected negative quotient is produced.\n */\n function div(a: number, b: number) {\n const q = a / b;\n /* v8 ignore next */\n if (q < 0) {\n throw new Error(\"Unexpected negative q\");\n }\n return Math.floor(q);\n }\n\n const y = year,\n skipMarchDays = 21,\n a = mod(y, 19),\n b = div(y, 100),\n c = mod(y, 100),\n d = div(b, 4),\n e = mod(b, 4),\n f = div(b + 8, 25),\n g = div(b - f + 1, 3),\n h = mod(19 * a + b - d - g + 15, 30),\n i = div(c, 4),\n k = mod(c, 4),\n l = mod(32 + 2 * e + 2 * i - h - k, 7),\n m = div(a + 11 * h + 22 * l, 451),\n t = h + l - 7 * m + skipMarchDays,\n n = div(t, 31) + 3,\n p = mod(t, 31);\n\n return new Date(year, n - 1, p + 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Father's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States and many other countries, Father's Day is observed on\n * the third Sunday of June.\n *\n * @param year - The year for which to calculate Father's Day.\n * @returns A {@link Date} representing the third Sunday in June.\n */\nexport function getFathersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 5), 0), 2);\n}\n","import { addDays } from \"date-fns\";\nimport { getEaster } from \"./getEaster\";\n\n/**\n * Calculates the date of Good Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Good Friday is observed two days before Easter Sunday and commemorates the\n * crucifixion of Jesus Christ in Christian tradition.\n *\n * @param year - The year for which to calculate Good Friday.\n * @returns A {@link Date} representing Good Friday in the specified year.\n */\nexport function getGoodFriday(year: number) {\n return addDays(getEaster(year), -2);\n}\n","/**\n * Returns the date of Halloween for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Halloween is observed annually on October 31.\n *\n * @param year - The year for which to obtain Halloween.\n * @returns A {@link Date} representing October 31 of the specified year.\n */\nexport function getHalloween(year: number) {\n return new Date(year, 9, 31);\n}\n","/**\n * Returns the date of Independence Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Independence Day in the United States is observed annually on July 4.\n *\n * @param year - The year for which to obtain Independence Day.\n * @returns A {@link Date} representing July 4 of the specified year.\n */\nexport function getIndependenceDay(year: number) {\n return new Date(year, 6, 4);\n}\n","/**\n * Returns the date of Juneteenth for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Juneteenth National Independence Day is observed in the United States on June 19.\n * It became a federal holiday in 2021.\n *\n * @param year - The year for which to obtain Juneteenth.\n * @returns A {@link Date} representing June 19 of the specified year.\n */\nexport function getJuneteenth(year: number) {\n return new Date(year, 5, 19);\n}\n","import { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Labor Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Labor Day is observed on the first Monday of September.\n *\n * @param year - The year for which to calculate Labor Day.\n * @returns A {@link Date} representing Labor Day in the specified year.\n */\nexport function getLaborDay(year: number) {\n return getFirstOccurrence(new Date(year, 8), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Martin Luther King Jr. Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Martin Luther King Jr. Day is observed on the third Monday of January.\n *\n * @param year - The year for which to calculate the holiday.\n * @returns A {@link Date} representing Martin Luther King Jr. Day in the specified year.\n */\nexport function getMartinLutherKingJrDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 0), 1), 2);\n}\n","import { getLastOfMonth } from \"../utils/getters\";\n\n/**\n * Returns the date of Memorial Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Memorial Day is observed on the last Monday of May.\n *\n * @param year - The year for which to calculate Memorial Day.\n * @returns A {@link Date} representing Memorial Day in the specified year.\n */\nexport function getMemorialDay(year: number) {\n return getLastOfMonth(new Date(year, 4), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Mother's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Mother's Day is observed on the second Sunday of May.\n *\n * @param year - The year for which to calculate Mother's Day.\n * @returns A {@link Date} representing Mother's Day in the specified year.\n */\nexport function getMothersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 4), 0), 1);\n}\n","/**\n * Returns the date of New Year's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Day is observed annually on January 1.\n *\n * @param year - The year for which to obtain New Year's Day.\n * @returns A {@link Date} representing January 1 of the specified year.\n */\nexport function getNewYearsDay(year: number) {\n return new Date(year, 0, 1);\n}\n","import { lastDayOfMonth } from \"date-fns\";\n\n/**\n * Returns the date of New Year's Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Eve is the last day of the year, observed on December 31.\n *\n * @param year - The year for which to obtain New Year's Eve.\n * @returns A {@link Date} representing December 31 of the specified year.\n */\nexport function getNewYearsEve(year: number) {\n return lastDayOfMonth(new Date(year, 11));\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Presidents Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Presidents Day is observed on the third Monday of February.\n *\n * @param year - The year for which to calculate Presidents Day.\n * @returns A {@link Date} representing Presidents Day in the specified year.\n */\nexport function getPresidentsDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 1), 1), 2);\n}\n","/**\n * Returns the date of St. Patrick's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * St. Patrick's Day is observed annually on March 17.\n *\n * It is not a U.S. federal holiday, but is widely celebrated culturally,\n * particularly in the United States and Ireland.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain St. Patrick's Day.\n * @returns A {@link Date} representing March 17 of the specified year.\n */\nexport function getStPatricksDay(year: number) {\n return new Date(year, 2, 17);\n}\n","/**\n * Returns the date of Valentine's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Valentine's Day is observed annually on February 14.\n *\n * @param year - The year for which to obtain Valentine's Day.\n * @returns A {@link Date} representing February 14 of the specified year.\n */\nexport function getValentinesDay(year: number) {\n return new Date(year, 1, 14);\n}\n","/**\n * Returns the date of Veterans Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Veterans Day is observed annually on November 11 in the United States.\n *\n * @param year - The year for which to obtain Veterans Day.\n * @returns A {@link Date} representing November 11 of the specified year.\n */\nexport function getVeteransDay(year: number) {\n return new Date(year, 10, 11);\n}\n","import { getHolidays } from \"../holidays\";\nimport type { Holiday, HolidayList, Holidays } from \"../types\";\n\n/**\n * Filters the full holiday set for a given year using a predicate.\n *\n * @category Utility\n *\n * @remarks\n * This function evaluates the complete {@link Holidays} object returned by\n * {@link getHolidays} and constructs a {@link HolidayList} containing only\n * entries that satisfy the provided predicate.\n *\n * The resulting object preserves the original holiday keys but reduces each\n * entry to its date value.\n *\n * @param year - The year for which to retrieve and filter holidays.\n * @param predicate - Function applied to each holiday entry to determine inclusion.\n * @returns A {@link HolidayList} containing only matching holidays.\n */\nexport function filterHolidays(\n year: number,\n predicate: (holiday: Holidays[Holiday]) => boolean,\n): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (predicate(holiday)) {\n result[name] = {\n date: holiday.date,\n };\n }\n }\n\n return result;\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all bank holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as bank holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve bank holidays.\n * @returns A {@link HolidayList} of bank holidays occurring in the specified year.\n */\nexport function getBankHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.bankHoliday);\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as federal holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve federal holidays.\n * @returns A {@link HolidayList} of federal holidays occurring in the specified year.\n */\nexport function getFederalHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.federal);\n}\n","import { getBlackFriday } from \"../holiday/getBlackFriday\";\nimport { getBoxingDay } from \"../holiday/getBoxingDay\";\nimport { getChristmas } from \"../holiday/getChristmas\";\nimport { getChristmasDay } from \"../holiday/getChristmasDay\";\nimport { getChristmasEve } from \"../holiday/getChristmasEve\";\nimport { getColumbusDay } from \"../holiday/getColumbusDay\";\nimport { getEaster } from \"../holiday/getEaster\";\nimport { getFathersDay } from \"../holiday/getFathersDay\";\nimport { getGoodFriday } from \"../holiday/getGoodFriday\";\nimport { getHalloween } from \"../holiday/getHalloween\";\nimport { getIndependenceDay } from \"../holiday/getIndependenceDay\";\nimport { getJuneteenth } from \"../holiday/getJuneteenth\";\nimport { getLaborDay } from \"../holiday/getLaborDay\";\nimport { getMartinLutherKingJrDay } from \"../holiday/getMartinLutherKingJrDay\";\nimport { getMemorialDay } from \"../holiday/getMemorialDay\";\nimport { getMothersDay } from \"../holiday/getMothersDay\";\nimport { getNewYearsDay } from \"../holiday/getNewYearsDay\";\nimport { getNewYearsEve } from \"../holiday/getNewYearsEve\";\nimport { getPresidentsDay } from \"../holiday/getPresidentsDay\";\nimport { getStPatricksDay } from \"../holiday/getStPatricksDay\";\nimport { getThanksgiving } from \"../holiday/getThanksgiving\";\nimport { getValentinesDay } from \"../holiday/getValentinesDay\";\nimport { getVeteransDay } from \"../holiday/getVeteransDay\";\nimport type { Holidays } from \"../types\";\n\n/**\n * Returns the complete set of supported holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Each holiday entry contains its calculated date together with metadata\n * indicating whether it is recognized as a federal holiday and/or a bank\n * holiday.\n *\n * Holiday observance classifications may vary by jurisdiction and may change\n * over time. The values returned by this function reflect the rules implemented\n * by this library.\n *\n * @param year - The year for which to generate holiday information.\n * @returns An object containing all supported holidays and their metadata.\n */\nexport function getHolidays(year: number): Holidays {\n return {\n blackFriday: {\n date: getBlackFriday(year),\n bankHoliday: false,\n federal: false,\n },\n boxingDay: {\n date: getBoxingDay(year),\n bankHoliday: false,\n federal: false,\n },\n /**\n * @deprecated use christmasDay instead\n */\n christmas: {\n date: getChristmas(year),\n bankHoliday: true,\n federal: true,\n },\n christmasDay: {\n date: getChristmasDay(year),\n bankHoliday: true,\n federal: true,\n },\n christmasEve: {\n date: getChristmasEve(year),\n bankHoliday: false,\n federal: false,\n },\n columbusDay: {\n date: getColumbusDay(year),\n bankHoliday: true,\n federal: true,\n },\n easter: {\n date: getEaster(year),\n bankHoliday: false,\n federal: false,\n },\n fathersDay: {\n date: getFathersDay(year),\n bankHoliday: false,\n federal: false,\n },\n goodFriday: {\n date: getGoodFriday(year),\n bankHoliday: false,\n federal: false,\n },\n halloween: {\n date: getHalloween(year),\n bankHoliday: false,\n federal: false,\n },\n independenceDay: {\n date: getIndependenceDay(year),\n bankHoliday: true,\n federal: true,\n },\n juneteenth: {\n date: getJuneteenth(year),\n bankHoliday: !(year < 2022),\n federal: true,\n },\n laborDay: {\n date: getLaborDay(year),\n bankHoliday: true,\n federal: true,\n },\n martinLutherKingJrDay: {\n date: getMartinLutherKingJrDay(year),\n bankHoliday: true,\n federal: true,\n },\n memorialDay: {\n date: getMemorialDay(year),\n bankHoliday: true,\n federal: true,\n },\n mothersDay: {\n date: getMothersDay(year),\n bankHoliday: false,\n federal: false,\n },\n newYearsDay: {\n date: getNewYearsDay(year),\n bankHoliday: true,\n federal: true,\n },\n newYearsEve: {\n date: getNewYearsEve(year),\n bankHoliday: false,\n federal: false,\n },\n presidentsDay: {\n date: getPresidentsDay(year),\n bankHoliday: true,\n federal: false,\n },\n stPatricksDay: {\n date: getStPatricksDay(year),\n bankHoliday: false,\n federal: false,\n },\n thanksgiving: {\n date: getThanksgiving(year),\n bankHoliday: true,\n federal: true,\n },\n valentinesDay: {\n date: getValentinesDay(year),\n bankHoliday: false,\n federal: false,\n },\n veteransDay: {\n date: getVeteransDay(year),\n bankHoliday: true,\n federal: true,\n },\n };\n}\n","import { addDays, isSaturday, isSunday } from \"date-fns\";\nimport type { HolidayList } from \"../types\";\nimport { getHolidays } from \"./getHolidays\";\n\n/**\n * Returns the observed federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * This function adjusts federal holidays that fall on weekends to their\n * observed dates:\n * - Saturday holidays are observed on the preceding Friday\n * - Sunday holidays are observed on the following Monday\n *\n * Only holidays marked as `federal: true` are included in the result.\n *\n * @param year - The year for which to calculate observed holidays.\n * @returns A {@link HolidayList} containing observed federal holiday dates.\n */\nexport function getObservedHolidays(year: number): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (!holiday.federal) {\n continue;\n }\n\n if (isSaturday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, -1),\n };\n } else if (isSunday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, 1),\n };\n }\n }\n\n return result;\n}\n","import { getYear, isSameDay } from \"date-fns\";\nimport { getBankHolidays } from \"../holidays/getBankHolidays\";\nimport { getFederalHolidays } from \"../holidays/getFederalHolidays\";\nimport { getHolidays } from \"../holidays/getHolidays\";\nimport type { HolidayList } from \"../types\";\n\n/**\n * Determines whether a given {@link Date} exists within a {@link HolidayList} for its year.\n *\n * @category Utility\n *\n * @remarks\n * The function resolves the appropriate holiday list for the year of the provided\n * {@link Date}, then checks whether any holiday in that list matches the given date\n * using calendar-day comparison (time components are ignored).\n *\n * @param date - The {@link Date} to evaluate.\n * @param getHolidayList - Function that returns a {@link HolidayList} for a given year.\n * @returns `true` if the {@link Date} matches any entry in the holiday list; otherwise `false`.\n */\nexport function isInHolidayList(\n date: Date,\n getHolidayList: (year: number) => HolidayList,\n): boolean {\n const holidays = getHolidayList(getYear(date));\n\n return Object.values(holidays).some((holiday) =>\n isSameDay(date, holiday.date),\n );\n}\n\n/**\n * Checks whether a {@link Date} is any recognized holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a holiday.\n */\nexport function isHoliday(date: Date): boolean {\n return isInHolidayList(date, getHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a federal holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a federal holiday.\n */\nexport function isFederalHoliday(date: Date): boolean {\n return isInHolidayList(date, getFederalHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a bank holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a bank holiday.\n */\nexport function isBankHoliday(date: Date): boolean {\n return isInHolidayList(date, getBankHolidays);\n}\n"],"mappings":"6FAoBA,SAAgB,EAAmB,EAAY,EAAwB,CACrE,OAAO,GAAA,EAAA,EAAA,QAAA,CAAgC,EAAM,CAAC,EAAG,CAAc,CACjE,CAeA,SAAgB,EAAkB,EAAY,EAAwB,CAUpE,OATA,EAAA,EAAA,OAAA,CAAiB,CAAI,IAAM,IAI3B,AAGE,GAHF,EAAA,EAAA,OAAA,CAAiB,CAAI,EAAI,GACvB,EAAA,EAAA,QAAA,CAAe,EAAM,GAAA,EAAA,EAAA,OAAA,CAAiB,CAAI,EAAI,CAAc,GAE5D,EAAA,EAAA,QAAA,CAAe,EAAM,GAAA,EAAA,EAAA,OAAA,CAA8B,CAAI,CAAC,GANjD,CASX,CAeA,SAAgB,EAAkB,EAAY,EAAwB,CAUpE,OATA,EAAA,EAAA,OAAA,CAAiB,CAAI,IAAM,IAI3B,AAGE,GAHF,EAAA,EAAA,OAAA,CAAiB,CAAI,EAAI,GACvB,EAAA,EAAA,QAAA,CAAe,EAAM,KAAA,EAAA,EAAA,OAAA,CAAmB,CAAI,EAAI,EAAe,GAE/D,EAAA,EAAA,QAAA,CAAe,EAAM,KAAA,EAAA,EAAA,OAAA,CAA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,EACX,CACF,CACF,CC/IA,SAAgB,EAAoB,EAA2B,CAC7D,IAAM,EAAsB,CAAC,EAE7B,IAAK,GAAM,CAAC,EAAM,KAAY,OAAO,QAAQ,EAAY,CAAI,CAAC,EACvD,EAAQ,WAIb,EAAA,EAAA,WAAA,CAAe,EAAQ,IAAI,EACzB,EAAO,GAAQ,CACb,MAAA,EAAA,EAAA,QAAA,CAAc,EAAQ,KAAM,EAAE,CAChC,GACK,EAAA,EAAA,SAAA,CAAa,EAAQ,IAAI,IAC9B,EAAO,GAAQ,CACb,MAAA,EAAA,EAAA,QAAA,CAAc,EAAQ,KAAM,CAAC,CAC/B,IAIJ,OAAO,CACT,CCpBA,SAAgB,EACd,EACA,EACS,CACT,IAAM,EAAW,GAAA,EAAA,EAAA,QAAA,CAAuB,CAAI,CAAC,EAE7C,OAAO,OAAO,OAAO,CAAQ,CAAC,CAAC,KAAM,IAAA,EAAA,EAAA,UAAA,CACzB,EAAM,EAAQ,IAAI,CAC9B,CACF,CAUA,SAAgB,EAAU,EAAqB,CAC7C,OAAO,EAAgB,EAAM,CAAW,CAC1C,CAUA,SAAgB,EAAiB,EAAqB,CACpD,OAAO,EAAgB,EAAM,CAAkB,CACjD,CAUA,SAAgB,EAAc,EAAqB,CACjD,OAAO,EAAgB,EAAM,CAAe,CAC9C"}
package/dist/index.d.cts CHANGED
@@ -36,6 +36,17 @@ declare function getBlackFriday(year: number): Date;
36
36
  declare function getBoxingDay(year: number): Date;
37
37
  //#endregion
38
38
  //#region src/holiday/getChristmas.d.ts
39
+ /**
40
+ * @deprecated Use {@link getChristmasDay} instead.
41
+ *
42
+ * @category Holiday
43
+ *
44
+ * @param year - The year for which to obtain Christmas Day.
45
+ * @returns A {@link Date} representing December 25 of the specified year.
46
+ */
47
+ declare function getChristmas(year: number): Date;
48
+ //#endregion
49
+ //#region src/holiday/getChristmasDay.d.ts
39
50
  /**
40
51
  * Returns the date of Christmas Day for the specified year.
41
52
  *
@@ -49,7 +60,7 @@ declare function getBoxingDay(year: number): Date;
49
60
  * @param year - The year for which to obtain Christmas Day.
50
61
  * @returns A {@link Date} representing December 25 of the specified year.
51
62
  */
52
- declare function getChristmas(year: number): Date;
63
+ declare function getChristmasDay(year: number): Date;
53
64
  //#endregion
54
65
  //#region src/holiday/getChristmasEve.d.ts
55
66
  /**
@@ -340,7 +351,7 @@ declare function getVeteransDay(year: number): Date;
340
351
  *
341
352
  * Each value corresponds to a key in {@link Holidays}.
342
353
  */
343
- type Holiday = "blackFriday" | "boxingDay" | "christmas" | "christmasEve" | "columbusDay" | "easter" | "fathersDay" | "goodFriday" | "halloween" | "independenceDay" | "juneteenth" | "laborDay" | "martinLutherKingJrDay" | "memorialDay" | "mothersDay" | "newYearsDay" | "newYearsEve" | "presidentsDay" | "stPatricksDay" | "thanksgiving" | "valentinesDay" | "veteransDay";
354
+ type Holiday = "blackFriday" | "boxingDay" | "christmas" | "christmasDay" | "christmasEve" | "columbusDay" | "easter" | "fathersDay" | "goodFriday" | "halloween" | "independenceDay" | "juneteenth" | "laborDay" | "martinLutherKingJrDay" | "memorialDay" | "mothersDay" | "newYearsDay" | "newYearsEve" | "presidentsDay" | "stPatricksDay" | "thanksgiving" | "valentinesDay" | "veteransDay";
344
355
  /**
345
356
  * Mapping of holiday names to their computed date values.
346
357
  *
@@ -553,5 +564,5 @@ declare function isFederalHoliday(date: Date): boolean;
553
564
  */
554
565
  declare function isBankHoliday(date: Date): boolean;
555
566
  //#endregion
556
- export { type Holiday, type HolidayList, type Holidays, filterHolidays, getBankHolidays, getBlackFriday, getBoxingDay, getChristmas, getChristmasEve, getColumbusDay, getEaster, getFathersDay, getFederalHolidays, getFirstOccurrence, getGoodFriday, getHalloween, getHolidays, getIndependenceDay, getJuneteenth, getLaborDay, getLastOfMonth, getMartinLutherKingJrDay, getMemorialDay, getMothersDay, getNewYearsDay, getNewYearsEve, getNextOccurrence, getObservedHolidays, getPresidentsDay, getPrevOccurrence, getStPatricksDay, getThanksgiving, getValentinesDay, getVeteransDay, isBankHoliday, isFederalHoliday, isHoliday, isInHolidayList };
567
+ export { type Holiday, type HolidayList, type Holidays, filterHolidays, getBankHolidays, getBlackFriday, getBoxingDay, getChristmas, getChristmasDay, getChristmasEve, getColumbusDay, getEaster, getFathersDay, getFederalHolidays, getFirstOccurrence, getGoodFriday, getHalloween, getHolidays, getIndependenceDay, getJuneteenth, getLaborDay, getLastOfMonth, getMartinLutherKingJrDay, getMemorialDay, getMothersDay, getNewYearsDay, getNewYearsEve, getNextOccurrence, getObservedHolidays, getPresidentsDay, getPrevOccurrence, getStPatricksDay, getThanksgiving, getValentinesDay, getVeteransDay, isBankHoliday, isFederalHoliday, isHoliday, isInHolidayList };
557
568
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -36,6 +36,17 @@ declare function getBlackFriday(year: number): Date;
36
36
  declare function getBoxingDay(year: number): Date;
37
37
  //#endregion
38
38
  //#region src/holiday/getChristmas.d.ts
39
+ /**
40
+ * @deprecated Use {@link getChristmasDay} instead.
41
+ *
42
+ * @category Holiday
43
+ *
44
+ * @param year - The year for which to obtain Christmas Day.
45
+ * @returns A {@link Date} representing December 25 of the specified year.
46
+ */
47
+ declare function getChristmas(year: number): Date;
48
+ //#endregion
49
+ //#region src/holiday/getChristmasDay.d.ts
39
50
  /**
40
51
  * Returns the date of Christmas Day for the specified year.
41
52
  *
@@ -49,7 +60,7 @@ declare function getBoxingDay(year: number): Date;
49
60
  * @param year - The year for which to obtain Christmas Day.
50
61
  * @returns A {@link Date} representing December 25 of the specified year.
51
62
  */
52
- declare function getChristmas(year: number): Date;
63
+ declare function getChristmasDay(year: number): Date;
53
64
  //#endregion
54
65
  //#region src/holiday/getChristmasEve.d.ts
55
66
  /**
@@ -340,7 +351,7 @@ declare function getVeteransDay(year: number): Date;
340
351
  *
341
352
  * Each value corresponds to a key in {@link Holidays}.
342
353
  */
343
- type Holiday = "blackFriday" | "boxingDay" | "christmas" | "christmasEve" | "columbusDay" | "easter" | "fathersDay" | "goodFriday" | "halloween" | "independenceDay" | "juneteenth" | "laborDay" | "martinLutherKingJrDay" | "memorialDay" | "mothersDay" | "newYearsDay" | "newYearsEve" | "presidentsDay" | "stPatricksDay" | "thanksgiving" | "valentinesDay" | "veteransDay";
354
+ type Holiday = "blackFriday" | "boxingDay" | "christmas" | "christmasDay" | "christmasEve" | "columbusDay" | "easter" | "fathersDay" | "goodFriday" | "halloween" | "independenceDay" | "juneteenth" | "laborDay" | "martinLutherKingJrDay" | "memorialDay" | "mothersDay" | "newYearsDay" | "newYearsEve" | "presidentsDay" | "stPatricksDay" | "thanksgiving" | "valentinesDay" | "veteransDay";
344
355
  /**
345
356
  * Mapping of holiday names to their computed date values.
346
357
  *
@@ -553,5 +564,5 @@ declare function isFederalHoliday(date: Date): boolean;
553
564
  */
554
565
  declare function isBankHoliday(date: Date): boolean;
555
566
  //#endregion
556
- export { type Holiday, type HolidayList, type Holidays, filterHolidays, getBankHolidays, getBlackFriday, getBoxingDay, getChristmas, getChristmasEve, getColumbusDay, getEaster, getFathersDay, getFederalHolidays, getFirstOccurrence, getGoodFriday, getHalloween, getHolidays, getIndependenceDay, getJuneteenth, getLaborDay, getLastOfMonth, getMartinLutherKingJrDay, getMemorialDay, getMothersDay, getNewYearsDay, getNewYearsEve, getNextOccurrence, getObservedHolidays, getPresidentsDay, getPrevOccurrence, getStPatricksDay, getThanksgiving, getValentinesDay, getVeteransDay, isBankHoliday, isFederalHoliday, isHoliday, isInHolidayList };
567
+ export { type Holiday, type HolidayList, type Holidays, filterHolidays, getBankHolidays, getBlackFriday, getBoxingDay, getChristmas, getChristmasDay, getChristmasEve, getColumbusDay, getEaster, getFathersDay, getFederalHolidays, getFirstOccurrence, getGoodFriday, getHalloween, getHolidays, getIndependenceDay, getJuneteenth, getLaborDay, getLastOfMonth, getMartinLutherKingJrDay, getMemorialDay, getMothersDay, getNewYearsDay, getNewYearsEve, getNextOccurrence, getObservedHolidays, getPresidentsDay, getPrevOccurrence, getStPatricksDay, getThanksgiving, getValentinesDay, getVeteransDay, isBankHoliday, isFederalHoliday, isHoliday, isInHolidayList };
557
568
  //# sourceMappingURL=index.d.mts.map
@@ -1,2 +1,2 @@
1
- var date_fns_holidays=(function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function n(e,n){return r((0,t.setDate)(e,1),n)}function r(e,n){return(0,t.getDay)(e)===n||(e=(0,t.getDay)(e)>n?(0,t.addDays)(e,7-(0,t.getDay)(e)+n):(0,t.addDays)(e,n-(0,t.getDay)(e))),e}function i(e,n){return(0,t.getDay)(e)===n||(e=(0,t.getDay)(e)>n?(0,t.addDays)(e,-1*((0,t.getDay)(e)-n)):(0,t.addDays)(e,-1*((0,t.getDay)(e)-0+(7-n)))),e}function a(e,n){return i((0,t.lastDayOfMonth)(e),n)}function o(e){return(0,t.addWeeks)(n(new Date(e,10),4),3)}function s(e){return(0,t.addDays)(o(e),1)}function c(e){return new Date(e,11,26)}function l(e){return new Date(e,11,25)}function u(e){return new Date(e,11,24)}function d(e){return(0,t.addWeeks)(n(new Date(e,9),1),1)}function f(e){if(e<325)throw RangeError(`Cannot calculate Easter dates before 325 AD.`);function t(e,t){return e%t}function n(e,t){let n=e/t;if(n<0)throw Error(`Unexpected negative q`);return Math.floor(n)}let r=e,i=t(r,19),a=n(r,100),o=t(r,100),s=n(a,4),c=t(a,4),l=n(a-n(a+8,25)+1,3),u=t(19*i+a-s-l+15,30),d=n(o,4),f=t(o,4),p=t(32+2*c+2*d-u-f,7),m=n(i+11*u+22*p,451),h=u+p-7*m+21,g=n(h,31)+3,_=t(h,31);return new Date(e,g-1,_+1)}function p(e){return(0,t.addWeeks)(n(new Date(e,5),0),2)}function m(e){return(0,t.addDays)(f(e),-2)}function h(e){return new Date(e,9,31)}function g(e){return new Date(e,6,4)}function _(e){return new Date(e,5,19)}function v(e){return n(new Date(e,8),1)}function y(e){return(0,t.addWeeks)(n(new Date(e,0),1),2)}function b(e){return a(new Date(e,4),1)}function x(e){return(0,t.addWeeks)(n(new Date(e,4),0),1)}function S(e){return new Date(e,0,1)}function C(e){return(0,t.lastDayOfMonth)(new Date(e,11))}function w(e){return(0,t.addWeeks)(n(new Date(e,1),1),2)}function T(e){return new Date(e,2,17)}function E(e){return new Date(e,1,14)}function D(e){return new Date(e,10,11)}function O(e,t){let n={};for(let[r,i]of Object.entries(j(e)))t(i)&&(n[r]={date:i.date});return n}function k(e){return O(e,e=>e.bankHoliday)}function A(e){return O(e,e=>e.federal)}function j(e){return{blackFriday:{date:s(e),bankHoliday:!1,federal:!1},boxingDay:{date:c(e),bankHoliday:!1,federal:!1},christmas:{date:l(e),bankHoliday:!0,federal:!0},christmasEve:{date:u(e),bankHoliday:!1,federal:!1},columbusDay:{date:d(e),bankHoliday:!0,federal:!0},easter:{date:f(e),bankHoliday:!1,federal:!1},fathersDay:{date:p(e),bankHoliday:!1,federal:!1},goodFriday:{date:m(e),bankHoliday:!1,federal:!1},halloween:{date:h(e),bankHoliday:!1,federal:!1},independenceDay:{date:g(e),bankHoliday:!0,federal:!0},juneteenth:{date:_(e),bankHoliday:!(e<2022),federal:!0},laborDay:{date:v(e),bankHoliday:!0,federal:!0},martinLutherKingJrDay:{date:y(e),bankHoliday:!0,federal:!0},memorialDay:{date:b(e),bankHoliday:!0,federal:!0},mothersDay:{date:x(e),bankHoliday:!1,federal:!1},newYearsDay:{date:S(e),bankHoliday:!0,federal:!0},newYearsEve:{date:C(e),bankHoliday:!1,federal:!1},presidentsDay:{date:w(e),bankHoliday:!0,federal:!1},stPatricksDay:{date:T(e),bankHoliday:!1,federal:!1},thanksgiving:{date:o(e),bankHoliday:!0,federal:!0},valentinesDay:{date:E(e),bankHoliday:!1,federal:!1},veteransDay:{date:D(e),bankHoliday:!0,federal:!0}}}function M(e){let n={};for(let[r,i]of Object.entries(j(e)))i.federal&&((0,t.isSaturday)(i.date)?n[r]={date:(0,t.addDays)(i.date,-1)}:(0,t.isSunday)(i.date)&&(n[r]={date:(0,t.addDays)(i.date,1)}));return n}function N(e,n){let r=n((0,t.getYear)(e));return Object.values(r).some(n=>(0,t.isSameDay)(e,n.date))}function P(e){return N(e,j)}function F(e){return N(e,A)}function I(e){return N(e,k)}return e.filterHolidays=O,e.getBankHolidays=k,e.getBlackFriday=s,e.getBoxingDay=c,e.getChristmas=l,e.getChristmasEve=u,e.getColumbusDay=d,e.getEaster=f,e.getFathersDay=p,e.getFederalHolidays=A,e.getFirstOccurrence=n,e.getGoodFriday=m,e.getHalloween=h,e.getHolidays=j,e.getIndependenceDay=g,e.getJuneteenth=_,e.getLaborDay=v,e.getLastOfMonth=a,e.getMartinLutherKingJrDay=y,e.getMemorialDay=b,e.getMothersDay=x,e.getNewYearsDay=S,e.getNewYearsEve=C,e.getNextOccurrence=r,e.getObservedHolidays=M,e.getPresidentsDay=w,e.getPrevOccurrence=i,e.getStPatricksDay=T,e.getThanksgiving=o,e.getValentinesDay=E,e.getVeteransDay=D,e.isBankHoliday=I,e.isFederalHoliday=F,e.isHoliday=P,e.isInHolidayList=N,e})({},date_fns);
1
+ var date_fns_holidays=(function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function n(e,n){return r((0,t.setDate)(e,1),n)}function r(e,n){return(0,t.getDay)(e)===n||(e=(0,t.getDay)(e)>n?(0,t.addDays)(e,7-(0,t.getDay)(e)+n):(0,t.addDays)(e,n-(0,t.getDay)(e))),e}function i(e,n){return(0,t.getDay)(e)===n||(e=(0,t.getDay)(e)>n?(0,t.addDays)(e,-1*((0,t.getDay)(e)-n)):(0,t.addDays)(e,-1*((0,t.getDay)(e)-0+(7-n)))),e}function a(e,n){return i((0,t.lastDayOfMonth)(e),n)}function o(e){return(0,t.addWeeks)(n(new Date(e,10),4),3)}function s(e){return(0,t.addDays)(o(e),1)}function c(e){return new Date(e,11,26)}function l(e){return new Date(e,11,25)}function u(e){return l(e)}function d(e){return new Date(e,11,24)}function f(e){return(0,t.addWeeks)(n(new Date(e,9),1),1)}function p(e){if(e<325)throw RangeError(`Cannot calculate Easter dates before 325 AD.`);function t(e,t){return e%t}function n(e,t){let n=e/t;if(n<0)throw Error(`Unexpected negative q`);return Math.floor(n)}let r=e,i=t(r,19),a=n(r,100),o=t(r,100),s=n(a,4),c=t(a,4),l=n(a-n(a+8,25)+1,3),u=t(19*i+a-s-l+15,30),d=n(o,4),f=t(o,4),p=t(32+2*c+2*d-u-f,7),m=n(i+11*u+22*p,451),h=u+p-7*m+21,g=n(h,31)+3,_=t(h,31);return new Date(e,g-1,_+1)}function m(e){return(0,t.addWeeks)(n(new Date(e,5),0),2)}function h(e){return(0,t.addDays)(p(e),-2)}function g(e){return new Date(e,9,31)}function _(e){return new Date(e,6,4)}function v(e){return new Date(e,5,19)}function y(e){return n(new Date(e,8),1)}function b(e){return(0,t.addWeeks)(n(new Date(e,0),1),2)}function x(e){return a(new Date(e,4),1)}function S(e){return(0,t.addWeeks)(n(new Date(e,4),0),1)}function C(e){return new Date(e,0,1)}function w(e){return(0,t.lastDayOfMonth)(new Date(e,11))}function T(e){return(0,t.addWeeks)(n(new Date(e,1),1),2)}function E(e){return new Date(e,2,17)}function D(e){return new Date(e,1,14)}function O(e){return new Date(e,10,11)}function k(e,t){let n={};for(let[r,i]of Object.entries(M(e)))t(i)&&(n[r]={date:i.date});return n}function A(e){return k(e,e=>e.bankHoliday)}function j(e){return k(e,e=>e.federal)}function M(e){return{blackFriday:{date:s(e),bankHoliday:!1,federal:!1},boxingDay:{date:c(e),bankHoliday:!1,federal:!1},christmas:{date:u(e),bankHoliday:!0,federal:!0},christmasDay:{date:l(e),bankHoliday:!0,federal:!0},christmasEve:{date:d(e),bankHoliday:!1,federal:!1},columbusDay:{date:f(e),bankHoliday:!0,federal:!0},easter:{date:p(e),bankHoliday:!1,federal:!1},fathersDay:{date:m(e),bankHoliday:!1,federal:!1},goodFriday:{date:h(e),bankHoliday:!1,federal:!1},halloween:{date:g(e),bankHoliday:!1,federal:!1},independenceDay:{date:_(e),bankHoliday:!0,federal:!0},juneteenth:{date:v(e),bankHoliday:!(e<2022),federal:!0},laborDay:{date:y(e),bankHoliday:!0,federal:!0},martinLutherKingJrDay:{date:b(e),bankHoliday:!0,federal:!0},memorialDay:{date:x(e),bankHoliday:!0,federal:!0},mothersDay:{date:S(e),bankHoliday:!1,federal:!1},newYearsDay:{date:C(e),bankHoliday:!0,federal:!0},newYearsEve:{date:w(e),bankHoliday:!1,federal:!1},presidentsDay:{date:T(e),bankHoliday:!0,federal:!1},stPatricksDay:{date:E(e),bankHoliday:!1,federal:!1},thanksgiving:{date:o(e),bankHoliday:!0,federal:!0},valentinesDay:{date:D(e),bankHoliday:!1,federal:!1},veteransDay:{date:O(e),bankHoliday:!0,federal:!0}}}function N(e){let n={};for(let[r,i]of Object.entries(M(e)))i.federal&&((0,t.isSaturday)(i.date)?n[r]={date:(0,t.addDays)(i.date,-1)}:(0,t.isSunday)(i.date)&&(n[r]={date:(0,t.addDays)(i.date,1)}));return n}function P(e,n){let r=n((0,t.getYear)(e));return Object.values(r).some(n=>(0,t.isSameDay)(e,n.date))}function F(e){return P(e,M)}function I(e){return P(e,j)}function L(e){return P(e,A)}return e.filterHolidays=k,e.getBankHolidays=A,e.getBlackFriday=s,e.getBoxingDay=c,e.getChristmas=u,e.getChristmasDay=l,e.getChristmasEve=d,e.getColumbusDay=f,e.getEaster=p,e.getFathersDay=m,e.getFederalHolidays=j,e.getFirstOccurrence=n,e.getGoodFriday=h,e.getHalloween=g,e.getHolidays=M,e.getIndependenceDay=_,e.getJuneteenth=v,e.getLaborDay=y,e.getLastOfMonth=a,e.getMartinLutherKingJrDay=b,e.getMemorialDay=x,e.getMothersDay=S,e.getNewYearsDay=C,e.getNewYearsEve=w,e.getNextOccurrence=r,e.getObservedHolidays=N,e.getPresidentsDay=T,e.getPrevOccurrence=i,e.getStPatricksDay=E,e.getThanksgiving=o,e.getValentinesDay=D,e.getVeteransDay=O,e.isBankHoliday=L,e.isFederalHoliday=I,e.isHoliday=F,e.isInHolidayList=P,e})({},date_fns);
2
2
  //# sourceMappingURL=index.iife.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.iife.js","names":[],"sources":["../src/utils/getters.ts","../src/holiday/getThanksgiving.ts","../src/holiday/getBlackFriday.ts","../src/holiday/getBoxingDay.ts","../src/holiday/getChristmas.ts","../src/holiday/getChristmasEve.ts","../src/holiday/getColumbusDay.ts","../src/holiday/getEaster.ts","../src/holiday/getFathersDay.ts","../src/holiday/getGoodFriday.ts","../src/holiday/getHalloween.ts","../src/holiday/getIndependenceDay.ts","../src/holiday/getJuneteenth.ts","../src/holiday/getLaborDay.ts","../src/holiday/getMartinLutherKingJrDay.ts","../src/holiday/getMemorialDay.ts","../src/holiday/getMothersDay.ts","../src/holiday/getNewYearsDay.ts","../src/holiday/getNewYearsEve.ts","../src/holiday/getPresidentsDay.ts","../src/holiday/getStPatricksDay.ts","../src/holiday/getValentinesDay.ts","../src/holiday/getVeteransDay.ts","../src/utils/filters.ts","../src/holidays/getBankHolidays.ts","../src/holidays/getFederalHolidays.ts","../src/holidays/getHolidays.ts","../src/holidays/getObservedHolidays.ts","../src/utils/isIn.ts"],"sourcesContent":["import {\n addDays,\n getDay as getDayOfWeek,\n lastDayOfMonth,\n setDate as setDayOfMonth,\n} from \"date-fns\";\n\n/**\n * Returns the first occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This works by normalizing the date to the first day of its month, then finding the\n * next occurrence of the specified weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the first occurrence of the weekday in that month.\n */\nexport function getFirstOccurrence(date: Date, dayOfWeekIndex: number) {\n return getNextOccurrence(setDayOfMonth(date, 1), dayOfWeekIndex);\n}\n\n/**\n * Returns the next occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function advances forward to the next matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the next occurrence of the weekday.\n */\nexport function getNextOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, 7 - getDayOfWeek(date) + dayOfWeekIndex);\n } else {\n date = addDays(date, dayOfWeekIndex - getDayOfWeek(date));\n }\n return date;\n}\n\n/**\n * Returns the previous occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function moves backward to the previous matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the previous occurrence of the weekday.\n */\nexport function getPrevOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, -1 * (getDayOfWeek(date) - dayOfWeekIndex));\n } else {\n date = addDays(date, -1 * (getDayOfWeek(date) - 0 + (7 - dayOfWeekIndex)));\n }\n return date;\n}\n\n/**\n * Returns the last occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This is computed by starting at the last day of the month and walking backwards\n * to the requested weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the last occurrence of the weekday in the month.\n */\nexport function getLastOfMonth(date: Date, dayOfWeekIndex: number) {\n return getPrevOccurrence(lastDayOfMonth(date), dayOfWeekIndex);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Thanksgiving for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Thanksgiving is observed on the fourth Thursday of November.\n *\n * @param year - The year for which to calculate Thanksgiving.\n * @returns A {@link Date} representing Thanksgiving in the specified year.\n */\nexport function getThanksgiving(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 10), 4), 3);\n}\n","import { addDays } from \"date-fns\";\nimport { getThanksgiving } from \"./getThanksgiving\";\n\n/**\n * Returns the date of Black Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Black Friday is observed annually on the day after Thanksgiving Day\n * in the United States (the fourth Friday of November).\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Black Friday.\n * @returns A {@link Date} representing Black Friday of the specified year.\n */\nexport function getBlackFriday(year: number) {\n return addDays(getThanksgiving(year), 1);\n}\n","/**\n * Returns the date of Boxing Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Boxing Day is observed on December 26 in several Commonwealth countries,\n * including the UK, Canada, Australia, and New Zealand.\n *\n * It is not a U.S. federal holiday, but it is a fixed calendar date\n * immediately following Christmas Day.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Boxing Day.\n * @returns A {@link Date} representing December 26 of the specified year.\n */\nexport function getBoxingDay(year: number) {\n return new Date(year, 11, 26);\n}\n","/**\n * Returns the date of Christmas Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Day is observed annually on December 25.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Day.\n * @returns A {@link Date} representing December 25 of the specified year.\n */\nexport function getChristmas(year: number) {\n return new Date(year, 11, 25);\n}\n","/**\n * Returns the date of Christmas Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Eve is observed annually on December 24.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Eve.\n * @returns A {@link Date} representing December 24 of the specified year.\n */\nexport function getChristmasEve(year: number) {\n return new Date(year, 11, 24);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Columbus Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Columbus Day is observed on the second Monday\n * of October.\n *\n * @param year - The year for which to calculate Columbus Day.\n * @returns A {@link Date} representing the second Monday in October.\n */\nexport function getColumbusDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 9), 1), 1);\n}\n","/**\n * Calculates the date of Easter Sunday for a given year using the\n * Gregorian computus algorithm.\n *\n * @category Holiday\n *\n * @remarks\n * This implementation is valid for years from 325 AD onward, the year of the\n * First Council of Nicaea, which established the basis for calculating Easter.\n *\n * The returned {@link Date} is created in the local time zone and represents\n * Easter Sunday for the specified year.\n *\n * @param year - The year for which to calculate Easter Sunday.\n * @returns A {@link Date} representing Easter Sunday in the specified year.\n * @throws {RangeError} Thrown if the year is earlier than 325 AD.\n */\nexport function getEaster(year: number) {\n if (year < 325) {\n throw new RangeError(\"Cannot calculate Easter dates before 325 AD.\");\n }\n\n /**\n * Computes the remainder of a division operation.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The remainder of `a / b`.\n */\n function mod(a: number, b: number) {\n return a % b;\n }\n\n /**\n * Performs integer division by truncating toward negative infinity.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The integer quotient of `a / b`.\n * @throws {Error} Thrown if an unexpected negative quotient is produced.\n */\n function div(a: number, b: number) {\n const q = a / b;\n /* v8 ignore next */\n if (q < 0) {\n throw new Error(\"Unexpected negative q\");\n }\n return Math.floor(q);\n }\n\n const y = year,\n skipMarchDays = 21,\n a = mod(y, 19),\n b = div(y, 100),\n c = mod(y, 100),\n d = div(b, 4),\n e = mod(b, 4),\n f = div(b + 8, 25),\n g = div(b - f + 1, 3),\n h = mod(19 * a + b - d - g + 15, 30),\n i = div(c, 4),\n k = mod(c, 4),\n l = mod(32 + 2 * e + 2 * i - h - k, 7),\n m = div(a + 11 * h + 22 * l, 451),\n t = h + l - 7 * m + skipMarchDays,\n n = div(t, 31) + 3,\n p = mod(t, 31);\n\n return new Date(year, n - 1, p + 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Father's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States and many other countries, Father's Day is observed on\n * the third Sunday of June.\n *\n * @param year - The year for which to calculate Father's Day.\n * @returns A {@link Date} representing the third Sunday in June.\n */\nexport function getFathersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 5), 0), 2);\n}\n","import { addDays } from \"date-fns\";\nimport { getEaster } from \"./getEaster\";\n\n/**\n * Calculates the date of Good Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Good Friday is observed two days before Easter Sunday and commemorates the\n * crucifixion of Jesus Christ in Christian tradition.\n *\n * @param year - The year for which to calculate Good Friday.\n * @returns A {@link Date} representing Good Friday in the specified year.\n */\nexport function getGoodFriday(year: number) {\n return addDays(getEaster(year), -2);\n}\n","/**\n * Returns the date of Halloween for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Halloween is observed annually on October 31.\n *\n * @param year - The year for which to obtain Halloween.\n * @returns A {@link Date} representing October 31 of the specified year.\n */\nexport function getHalloween(year: number) {\n return new Date(year, 9, 31);\n}\n","/**\n * Returns the date of Independence Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Independence Day in the United States is observed annually on July 4.\n *\n * @param year - The year for which to obtain Independence Day.\n * @returns A {@link Date} representing July 4 of the specified year.\n */\nexport function getIndependenceDay(year: number) {\n return new Date(year, 6, 4);\n}\n","/**\n * Returns the date of Juneteenth for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Juneteenth National Independence Day is observed in the United States on June 19.\n * It became a federal holiday in 2021.\n *\n * @param year - The year for which to obtain Juneteenth.\n * @returns A {@link Date} representing June 19 of the specified year.\n */\nexport function getJuneteenth(year: number) {\n return new Date(year, 5, 19);\n}\n","import { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Labor Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Labor Day is observed on the first Monday of September.\n *\n * @param year - The year for which to calculate Labor Day.\n * @returns A {@link Date} representing Labor Day in the specified year.\n */\nexport function getLaborDay(year: number) {\n return getFirstOccurrence(new Date(year, 8), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Martin Luther King Jr. Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Martin Luther King Jr. Day is observed on the third Monday of January.\n *\n * @param year - The year for which to calculate the holiday.\n * @returns A {@link Date} representing Martin Luther King Jr. Day in the specified year.\n */\nexport function getMartinLutherKingJrDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 0), 1), 2);\n}\n","import { getLastOfMonth } from \"../utils/getters\";\n\n/**\n * Returns the date of Memorial Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Memorial Day is observed on the last Monday of May.\n *\n * @param year - The year for which to calculate Memorial Day.\n * @returns A {@link Date} representing Memorial Day in the specified year.\n */\nexport function getMemorialDay(year: number) {\n return getLastOfMonth(new Date(year, 4), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Mother's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Mother's Day is observed on the second Sunday of May.\n *\n * @param year - The year for which to calculate Mother's Day.\n * @returns A {@link Date} representing Mother's Day in the specified year.\n */\nexport function getMothersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 4), 0), 1);\n}\n","/**\n * Returns the date of New Year's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Day is observed annually on January 1.\n *\n * @param year - The year for which to obtain New Year's Day.\n * @returns A {@link Date} representing January 1 of the specified year.\n */\nexport function getNewYearsDay(year: number) {\n return new Date(year, 0, 1);\n}\n","import { lastDayOfMonth } from \"date-fns\";\n\n/**\n * Returns the date of New Year's Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Eve is the last day of the year, observed on December 31.\n *\n * @param year - The year for which to obtain New Year's Eve.\n * @returns A {@link Date} representing December 31 of the specified year.\n */\nexport function getNewYearsEve(year: number) {\n return lastDayOfMonth(new Date(year, 11));\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Presidents Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Presidents Day is observed on the third Monday of February.\n *\n * @param year - The year for which to calculate Presidents Day.\n * @returns A {@link Date} representing Presidents Day in the specified year.\n */\nexport function getPresidentsDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 1), 1), 2);\n}\n","/**\n * Returns the date of St. Patrick's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * St. Patrick's Day is observed annually on March 17.\n *\n * It is not a U.S. federal holiday, but is widely celebrated culturally,\n * particularly in the United States and Ireland.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain St. Patrick's Day.\n * @returns A {@link Date} representing March 17 of the specified year.\n */\nexport function getStPatricksDay(year: number) {\n return new Date(year, 2, 17);\n}\n","/**\n * Returns the date of Valentine's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Valentine's Day is observed annually on February 14.\n *\n * @param year - The year for which to obtain Valentine's Day.\n * @returns A {@link Date} representing February 14 of the specified year.\n */\nexport function getValentinesDay(year: number) {\n return new Date(year, 1, 14);\n}\n","/**\n * Returns the date of Veterans Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Veterans Day is observed annually on November 11 in the United States.\n *\n * @param year - The year for which to obtain Veterans Day.\n * @returns A {@link Date} representing November 11 of the specified year.\n */\nexport function getVeteransDay(year: number) {\n return new Date(year, 10, 11);\n}\n","import { getHolidays } from \"../holidays\";\nimport type { Holiday, HolidayList, Holidays } from \"../types\";\n\n/**\n * Filters the full holiday set for a given year using a predicate.\n *\n * @category Utility\n *\n * @remarks\n * This function evaluates the complete {@link Holidays} object returned by\n * {@link getHolidays} and constructs a {@link HolidayList} containing only\n * entries that satisfy the provided predicate.\n *\n * The resulting object preserves the original holiday keys but reduces each\n * entry to its date value.\n *\n * @param year - The year for which to retrieve and filter holidays.\n * @param predicate - Function applied to each holiday entry to determine inclusion.\n * @returns A {@link HolidayList} containing only matching holidays.\n */\nexport function filterHolidays(\n year: number,\n predicate: (holiday: Holidays[Holiday]) => boolean,\n): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (predicate(holiday)) {\n result[name] = {\n date: holiday.date,\n };\n }\n }\n\n return result;\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all bank holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as bank holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve bank holidays.\n * @returns A {@link HolidayList} of bank holidays occurring in the specified year.\n */\nexport function getBankHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.bankHoliday);\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as federal holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve federal holidays.\n * @returns A {@link HolidayList} of federal holidays occurring in the specified year.\n */\nexport function getFederalHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.federal);\n}\n","import { getBlackFriday } from \"../holiday/getBlackFriday\";\nimport { getBoxingDay } from \"../holiday/getBoxingDay\";\nimport { getChristmas } from \"../holiday/getChristmas\";\nimport { getChristmasEve } from \"../holiday/getChristmasEve\";\nimport { getColumbusDay } from \"../holiday/getColumbusDay\";\nimport { getEaster } from \"../holiday/getEaster\";\nimport { getFathersDay } from \"../holiday/getFathersDay\";\nimport { getGoodFriday } from \"../holiday/getGoodFriday\";\nimport { getHalloween } from \"../holiday/getHalloween\";\nimport { getIndependenceDay } from \"../holiday/getIndependenceDay\";\nimport { getJuneteenth } from \"../holiday/getJuneteenth\";\nimport { getLaborDay } from \"../holiday/getLaborDay\";\nimport { getMartinLutherKingJrDay } from \"../holiday/getMartinLutherKingJrDay\";\nimport { getMemorialDay } from \"../holiday/getMemorialDay\";\nimport { getMothersDay } from \"../holiday/getMothersDay\";\nimport { getNewYearsDay } from \"../holiday/getNewYearsDay\";\nimport { getNewYearsEve } from \"../holiday/getNewYearsEve\";\nimport { getPresidentsDay } from \"../holiday/getPresidentsDay\";\nimport { getStPatricksDay } from \"../holiday/getStPatricksDay\";\nimport { getThanksgiving } from \"../holiday/getThanksgiving\";\nimport { getValentinesDay } from \"../holiday/getValentinesDay\";\nimport { getVeteransDay } from \"../holiday/getVeteransDay\";\nimport type { Holidays } from \"../types\";\n\n/**\n * Returns the complete set of supported holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Each holiday entry contains its calculated date together with metadata\n * indicating whether it is recognized as a federal holiday and/or a bank\n * holiday.\n *\n * Holiday observance classifications may vary by jurisdiction and may change\n * over time. The values returned by this function reflect the rules implemented\n * by this library.\n *\n * @param year - The year for which to generate holiday information.\n * @returns An object containing all supported holidays and their metadata.\n */\nexport function getHolidays(year: number): Holidays {\n return {\n blackFriday: {\n date: getBlackFriday(year),\n bankHoliday: false,\n federal: false,\n },\n boxingDay: {\n date: getBoxingDay(year),\n bankHoliday: false,\n federal: false,\n },\n christmas: {\n date: getChristmas(year),\n bankHoliday: true,\n federal: true,\n },\n christmasEve: {\n date: getChristmasEve(year),\n bankHoliday: false,\n federal: false,\n },\n columbusDay: {\n date: getColumbusDay(year),\n bankHoliday: true,\n federal: true,\n },\n easter: {\n date: getEaster(year),\n bankHoliday: false,\n federal: false,\n },\n fathersDay: {\n date: getFathersDay(year),\n bankHoliday: false,\n federal: false,\n },\n goodFriday: {\n date: getGoodFriday(year),\n bankHoliday: false,\n federal: false,\n },\n halloween: {\n date: getHalloween(year),\n bankHoliday: false,\n federal: false,\n },\n independenceDay: {\n date: getIndependenceDay(year),\n bankHoliday: true,\n federal: true,\n },\n juneteenth: {\n date: getJuneteenth(year),\n bankHoliday: !(year < 2022),\n federal: true,\n },\n laborDay: {\n date: getLaborDay(year),\n bankHoliday: true,\n federal: true,\n },\n martinLutherKingJrDay: {\n date: getMartinLutherKingJrDay(year),\n bankHoliday: true,\n federal: true,\n },\n memorialDay: {\n date: getMemorialDay(year),\n bankHoliday: true,\n federal: true,\n },\n mothersDay: {\n date: getMothersDay(year),\n bankHoliday: false,\n federal: false,\n },\n newYearsDay: {\n date: getNewYearsDay(year),\n bankHoliday: true,\n federal: true,\n },\n newYearsEve: {\n date: getNewYearsEve(year),\n bankHoliday: false,\n federal: false,\n },\n presidentsDay: {\n date: getPresidentsDay(year),\n bankHoliday: true,\n federal: false,\n },\n stPatricksDay: {\n date: getStPatricksDay(year),\n bankHoliday: false,\n federal: false,\n },\n thanksgiving: {\n date: getThanksgiving(year),\n bankHoliday: true,\n federal: true,\n },\n valentinesDay: {\n date: getValentinesDay(year),\n bankHoliday: false,\n federal: false,\n },\n veteransDay: {\n date: getVeteransDay(year),\n bankHoliday: true,\n federal: true,\n },\n };\n}\n","import { addDays, isSaturday, isSunday } from \"date-fns\";\nimport type { HolidayList } from \"../types\";\nimport { getHolidays } from \"./getHolidays\";\n\n/**\n * Returns the observed federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * This function adjusts federal holidays that fall on weekends to their\n * observed dates:\n * - Saturday holidays are observed on the preceding Friday\n * - Sunday holidays are observed on the following Monday\n *\n * Only holidays marked as `federal: true` are included in the result.\n *\n * @param year - The year for which to calculate observed holidays.\n * @returns A {@link HolidayList} containing observed federal holiday dates.\n */\nexport function getObservedHolidays(year: number): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (!holiday.federal) {\n continue;\n }\n\n if (isSaturday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, -1),\n };\n } else if (isSunday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, 1),\n };\n }\n }\n\n return result;\n}\n","import { getYear, isSameDay } from \"date-fns\";\nimport { getBankHolidays } from \"../holidays/getBankHolidays\";\nimport { getFederalHolidays } from \"../holidays/getFederalHolidays\";\nimport { getHolidays } from \"../holidays/getHolidays\";\nimport type { HolidayList } from \"../types\";\n\n/**\n * Determines whether a given {@link Date} exists within a {@link HolidayList} for its year.\n *\n * @category Utility\n *\n * @remarks\n * The function resolves the appropriate holiday list for the year of the provided\n * {@link Date}, then checks whether any holiday in that list matches the given date\n * using calendar-day comparison (time components are ignored).\n *\n * @param date - The {@link Date} to evaluate.\n * @param getHolidayList - Function that returns a {@link HolidayList} for a given year.\n * @returns `true` if the {@link Date} matches any entry in the holiday list; otherwise `false`.\n */\nexport function isInHolidayList(\n date: Date,\n getHolidayList: (year: number) => HolidayList,\n): boolean {\n const holidays = getHolidayList(getYear(date));\n\n return Object.values(holidays).some((holiday) =>\n isSameDay(date, holiday.date),\n );\n}\n\n/**\n * Checks whether a {@link Date} is any recognized holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a holiday.\n */\nexport function isHoliday(date: Date): boolean {\n return isInHolidayList(date, getHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a federal holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a federal holiday.\n */\nexport function isFederalHoliday(date: Date): boolean {\n return isInHolidayList(date, getFederalHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a bank holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a bank holiday.\n */\nexport function isBankHoliday(date: Date): boolean {\n return isInHolidayList(date, getBankHolidays);\n}\n"],"mappings":"kGAoBA,SAAgB,EAAmB,EAAY,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CAAW,CAC1C,CAUA,SAAgB,EAAiB,EAAqB,CACpD,OAAO,EAAgB,EAAM,CAAkB,CACjD,CAUA,SAAgB,EAAc,EAAqB,CACjD,OAAO,EAAgB,EAAM,CAAe,CAC9C"}
1
+ {"version":3,"file":"index.iife.js","names":[],"sources":["../src/utils/getters.ts","../src/holiday/getThanksgiving.ts","../src/holiday/getBlackFriday.ts","../src/holiday/getBoxingDay.ts","../src/holiday/getChristmasDay.ts","../src/holiday/getChristmas.ts","../src/holiday/getChristmasEve.ts","../src/holiday/getColumbusDay.ts","../src/holiday/getEaster.ts","../src/holiday/getFathersDay.ts","../src/holiday/getGoodFriday.ts","../src/holiday/getHalloween.ts","../src/holiday/getIndependenceDay.ts","../src/holiday/getJuneteenth.ts","../src/holiday/getLaborDay.ts","../src/holiday/getMartinLutherKingJrDay.ts","../src/holiday/getMemorialDay.ts","../src/holiday/getMothersDay.ts","../src/holiday/getNewYearsDay.ts","../src/holiday/getNewYearsEve.ts","../src/holiday/getPresidentsDay.ts","../src/holiday/getStPatricksDay.ts","../src/holiday/getValentinesDay.ts","../src/holiday/getVeteransDay.ts","../src/utils/filters.ts","../src/holidays/getBankHolidays.ts","../src/holidays/getFederalHolidays.ts","../src/holidays/getHolidays.ts","../src/holidays/getObservedHolidays.ts","../src/utils/isIn.ts"],"sourcesContent":["import {\n addDays,\n getDay as getDayOfWeek,\n lastDayOfMonth,\n setDate as setDayOfMonth,\n} from \"date-fns\";\n\n/**\n * Returns the first occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This works by normalizing the date to the first day of its month, then finding the\n * next occurrence of the specified weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the first occurrence of the weekday in that month.\n */\nexport function getFirstOccurrence(date: Date, dayOfWeekIndex: number) {\n return getNextOccurrence(setDayOfMonth(date, 1), dayOfWeekIndex);\n}\n\n/**\n * Returns the next occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function advances forward to the next matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the next occurrence of the weekday.\n */\nexport function getNextOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, 7 - getDayOfWeek(date) + dayOfWeekIndex);\n } else {\n date = addDays(date, dayOfWeekIndex - getDayOfWeek(date));\n }\n return date;\n}\n\n/**\n * Returns the previous occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function moves backward to the previous matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the previous occurrence of the weekday.\n */\nexport function getPrevOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, -1 * (getDayOfWeek(date) - dayOfWeekIndex));\n } else {\n date = addDays(date, -1 * (getDayOfWeek(date) - 0 + (7 - dayOfWeekIndex)));\n }\n return date;\n}\n\n/**\n * Returns the last occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This is computed by starting at the last day of the month and walking backwards\n * to the requested weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the last occurrence of the weekday in the month.\n */\nexport function getLastOfMonth(date: Date, dayOfWeekIndex: number) {\n return getPrevOccurrence(lastDayOfMonth(date), dayOfWeekIndex);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Thanksgiving for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Thanksgiving is observed on the fourth Thursday of November.\n *\n * @param year - The year for which to calculate Thanksgiving.\n * @returns A {@link Date} representing Thanksgiving in the specified year.\n */\nexport function getThanksgiving(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 10), 4), 3);\n}\n","import { addDays } from \"date-fns\";\nimport { getThanksgiving } from \"./getThanksgiving\";\n\n/**\n * Returns the date of Black Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Black Friday is observed annually on the day after Thanksgiving Day\n * in the United States (the fourth Friday of November).\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Black Friday.\n * @returns A {@link Date} representing Black Friday of the specified year.\n */\nexport function getBlackFriday(year: number) {\n return addDays(getThanksgiving(year), 1);\n}\n","/**\n * Returns the date of Boxing Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Boxing Day is observed on December 26 in several Commonwealth countries,\n * including the UK, Canada, Australia, and New Zealand.\n *\n * It is not a U.S. federal holiday, but it is a fixed calendar date\n * immediately following Christmas Day.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Boxing Day.\n * @returns A {@link Date} representing December 26 of the specified year.\n */\nexport function getBoxingDay(year: number) {\n return new Date(year, 11, 26);\n}\n","/**\n * Returns the date of Christmas Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Day is observed annually on December 25.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Day.\n * @returns A {@link Date} representing December 25 of the specified year.\n */\nexport function getChristmasDay(year: number) {\n return new Date(year, 11, 25);\n}\n","import { getChristmasDay } from \"./getChristmasDay\";\n\n/**\n * @deprecated Use {@link getChristmasDay} instead.\n *\n * @category Holiday\n *\n * @param year - The year for which to obtain Christmas Day.\n * @returns A {@link Date} representing December 25 of the specified year.\n */\nexport function getChristmas(year: number) {\n return getChristmasDay(year);\n}\n","/**\n * Returns the date of Christmas Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Eve is observed annually on December 24.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Eve.\n * @returns A {@link Date} representing December 24 of the specified year.\n */\nexport function getChristmasEve(year: number) {\n return new Date(year, 11, 24);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Columbus Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Columbus Day is observed on the second Monday\n * of October.\n *\n * @param year - The year for which to calculate Columbus Day.\n * @returns A {@link Date} representing the second Monday in October.\n */\nexport function getColumbusDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 9), 1), 1);\n}\n","/**\n * Calculates the date of Easter Sunday for a given year using the\n * Gregorian computus algorithm.\n *\n * @category Holiday\n *\n * @remarks\n * This implementation is valid for years from 325 AD onward, the year of the\n * First Council of Nicaea, which established the basis for calculating Easter.\n *\n * The returned {@link Date} is created in the local time zone and represents\n * Easter Sunday for the specified year.\n *\n * @param year - The year for which to calculate Easter Sunday.\n * @returns A {@link Date} representing Easter Sunday in the specified year.\n * @throws {RangeError} Thrown if the year is earlier than 325 AD.\n */\nexport function getEaster(year: number) {\n if (year < 325) {\n throw new RangeError(\"Cannot calculate Easter dates before 325 AD.\");\n }\n\n /**\n * Computes the remainder of a division operation.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The remainder of `a / b`.\n */\n function mod(a: number, b: number) {\n return a % b;\n }\n\n /**\n * Performs integer division by truncating toward negative infinity.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The integer quotient of `a / b`.\n * @throws {Error} Thrown if an unexpected negative quotient is produced.\n */\n function div(a: number, b: number) {\n const q = a / b;\n /* v8 ignore next */\n if (q < 0) {\n throw new Error(\"Unexpected negative q\");\n }\n return Math.floor(q);\n }\n\n const y = year,\n skipMarchDays = 21,\n a = mod(y, 19),\n b = div(y, 100),\n c = mod(y, 100),\n d = div(b, 4),\n e = mod(b, 4),\n f = div(b + 8, 25),\n g = div(b - f + 1, 3),\n h = mod(19 * a + b - d - g + 15, 30),\n i = div(c, 4),\n k = mod(c, 4),\n l = mod(32 + 2 * e + 2 * i - h - k, 7),\n m = div(a + 11 * h + 22 * l, 451),\n t = h + l - 7 * m + skipMarchDays,\n n = div(t, 31) + 3,\n p = mod(t, 31);\n\n return new Date(year, n - 1, p + 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Father's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States and many other countries, Father's Day is observed on\n * the third Sunday of June.\n *\n * @param year - The year for which to calculate Father's Day.\n * @returns A {@link Date} representing the third Sunday in June.\n */\nexport function getFathersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 5), 0), 2);\n}\n","import { addDays } from \"date-fns\";\nimport { getEaster } from \"./getEaster\";\n\n/**\n * Calculates the date of Good Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Good Friday is observed two days before Easter Sunday and commemorates the\n * crucifixion of Jesus Christ in Christian tradition.\n *\n * @param year - The year for which to calculate Good Friday.\n * @returns A {@link Date} representing Good Friday in the specified year.\n */\nexport function getGoodFriday(year: number) {\n return addDays(getEaster(year), -2);\n}\n","/**\n * Returns the date of Halloween for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Halloween is observed annually on October 31.\n *\n * @param year - The year for which to obtain Halloween.\n * @returns A {@link Date} representing October 31 of the specified year.\n */\nexport function getHalloween(year: number) {\n return new Date(year, 9, 31);\n}\n","/**\n * Returns the date of Independence Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Independence Day in the United States is observed annually on July 4.\n *\n * @param year - The year for which to obtain Independence Day.\n * @returns A {@link Date} representing July 4 of the specified year.\n */\nexport function getIndependenceDay(year: number) {\n return new Date(year, 6, 4);\n}\n","/**\n * Returns the date of Juneteenth for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Juneteenth National Independence Day is observed in the United States on June 19.\n * It became a federal holiday in 2021.\n *\n * @param year - The year for which to obtain Juneteenth.\n * @returns A {@link Date} representing June 19 of the specified year.\n */\nexport function getJuneteenth(year: number) {\n return new Date(year, 5, 19);\n}\n","import { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Labor Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Labor Day is observed on the first Monday of September.\n *\n * @param year - The year for which to calculate Labor Day.\n * @returns A {@link Date} representing Labor Day in the specified year.\n */\nexport function getLaborDay(year: number) {\n return getFirstOccurrence(new Date(year, 8), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Martin Luther King Jr. Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Martin Luther King Jr. Day is observed on the third Monday of January.\n *\n * @param year - The year for which to calculate the holiday.\n * @returns A {@link Date} representing Martin Luther King Jr. Day in the specified year.\n */\nexport function getMartinLutherKingJrDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 0), 1), 2);\n}\n","import { getLastOfMonth } from \"../utils/getters\";\n\n/**\n * Returns the date of Memorial Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Memorial Day is observed on the last Monday of May.\n *\n * @param year - The year for which to calculate Memorial Day.\n * @returns A {@link Date} representing Memorial Day in the specified year.\n */\nexport function getMemorialDay(year: number) {\n return getLastOfMonth(new Date(year, 4), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Mother's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Mother's Day is observed on the second Sunday of May.\n *\n * @param year - The year for which to calculate Mother's Day.\n * @returns A {@link Date} representing Mother's Day in the specified year.\n */\nexport function getMothersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 4), 0), 1);\n}\n","/**\n * Returns the date of New Year's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Day is observed annually on January 1.\n *\n * @param year - The year for which to obtain New Year's Day.\n * @returns A {@link Date} representing January 1 of the specified year.\n */\nexport function getNewYearsDay(year: number) {\n return new Date(year, 0, 1);\n}\n","import { lastDayOfMonth } from \"date-fns\";\n\n/**\n * Returns the date of New Year's Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Eve is the last day of the year, observed on December 31.\n *\n * @param year - The year for which to obtain New Year's Eve.\n * @returns A {@link Date} representing December 31 of the specified year.\n */\nexport function getNewYearsEve(year: number) {\n return lastDayOfMonth(new Date(year, 11));\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Presidents Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Presidents Day is observed on the third Monday of February.\n *\n * @param year - The year for which to calculate Presidents Day.\n * @returns A {@link Date} representing Presidents Day in the specified year.\n */\nexport function getPresidentsDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 1), 1), 2);\n}\n","/**\n * Returns the date of St. Patrick's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * St. Patrick's Day is observed annually on March 17.\n *\n * It is not a U.S. federal holiday, but is widely celebrated culturally,\n * particularly in the United States and Ireland.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain St. Patrick's Day.\n * @returns A {@link Date} representing March 17 of the specified year.\n */\nexport function getStPatricksDay(year: number) {\n return new Date(year, 2, 17);\n}\n","/**\n * Returns the date of Valentine's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Valentine's Day is observed annually on February 14.\n *\n * @param year - The year for which to obtain Valentine's Day.\n * @returns A {@link Date} representing February 14 of the specified year.\n */\nexport function getValentinesDay(year: number) {\n return new Date(year, 1, 14);\n}\n","/**\n * Returns the date of Veterans Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Veterans Day is observed annually on November 11 in the United States.\n *\n * @param year - The year for which to obtain Veterans Day.\n * @returns A {@link Date} representing November 11 of the specified year.\n */\nexport function getVeteransDay(year: number) {\n return new Date(year, 10, 11);\n}\n","import { getHolidays } from \"../holidays\";\nimport type { Holiday, HolidayList, Holidays } from \"../types\";\n\n/**\n * Filters the full holiday set for a given year using a predicate.\n *\n * @category Utility\n *\n * @remarks\n * This function evaluates the complete {@link Holidays} object returned by\n * {@link getHolidays} and constructs a {@link HolidayList} containing only\n * entries that satisfy the provided predicate.\n *\n * The resulting object preserves the original holiday keys but reduces each\n * entry to its date value.\n *\n * @param year - The year for which to retrieve and filter holidays.\n * @param predicate - Function applied to each holiday entry to determine inclusion.\n * @returns A {@link HolidayList} containing only matching holidays.\n */\nexport function filterHolidays(\n year: number,\n predicate: (holiday: Holidays[Holiday]) => boolean,\n): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (predicate(holiday)) {\n result[name] = {\n date: holiday.date,\n };\n }\n }\n\n return result;\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all bank holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as bank holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve bank holidays.\n * @returns A {@link HolidayList} of bank holidays occurring in the specified year.\n */\nexport function getBankHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.bankHoliday);\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as federal holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve federal holidays.\n * @returns A {@link HolidayList} of federal holidays occurring in the specified year.\n */\nexport function getFederalHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.federal);\n}\n","import { getBlackFriday } from \"../holiday/getBlackFriday\";\nimport { getBoxingDay } from \"../holiday/getBoxingDay\";\nimport { getChristmas } from \"../holiday/getChristmas\";\nimport { getChristmasDay } from \"../holiday/getChristmasDay\";\nimport { getChristmasEve } from \"../holiday/getChristmasEve\";\nimport { getColumbusDay } from \"../holiday/getColumbusDay\";\nimport { getEaster } from \"../holiday/getEaster\";\nimport { getFathersDay } from \"../holiday/getFathersDay\";\nimport { getGoodFriday } from \"../holiday/getGoodFriday\";\nimport { getHalloween } from \"../holiday/getHalloween\";\nimport { getIndependenceDay } from \"../holiday/getIndependenceDay\";\nimport { getJuneteenth } from \"../holiday/getJuneteenth\";\nimport { getLaborDay } from \"../holiday/getLaborDay\";\nimport { getMartinLutherKingJrDay } from \"../holiday/getMartinLutherKingJrDay\";\nimport { getMemorialDay } from \"../holiday/getMemorialDay\";\nimport { getMothersDay } from \"../holiday/getMothersDay\";\nimport { getNewYearsDay } from \"../holiday/getNewYearsDay\";\nimport { getNewYearsEve } from \"../holiday/getNewYearsEve\";\nimport { getPresidentsDay } from \"../holiday/getPresidentsDay\";\nimport { getStPatricksDay } from \"../holiday/getStPatricksDay\";\nimport { getThanksgiving } from \"../holiday/getThanksgiving\";\nimport { getValentinesDay } from \"../holiday/getValentinesDay\";\nimport { getVeteransDay } from \"../holiday/getVeteransDay\";\nimport type { Holidays } from \"../types\";\n\n/**\n * Returns the complete set of supported holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Each holiday entry contains its calculated date together with metadata\n * indicating whether it is recognized as a federal holiday and/or a bank\n * holiday.\n *\n * Holiday observance classifications may vary by jurisdiction and may change\n * over time. The values returned by this function reflect the rules implemented\n * by this library.\n *\n * @param year - The year for which to generate holiday information.\n * @returns An object containing all supported holidays and their metadata.\n */\nexport function getHolidays(year: number): Holidays {\n return {\n blackFriday: {\n date: getBlackFriday(year),\n bankHoliday: false,\n federal: false,\n },\n boxingDay: {\n date: getBoxingDay(year),\n bankHoliday: false,\n federal: false,\n },\n /**\n * @deprecated use christmasDay instead\n */\n christmas: {\n date: getChristmas(year),\n bankHoliday: true,\n federal: true,\n },\n christmasDay: {\n date: getChristmasDay(year),\n bankHoliday: true,\n federal: true,\n },\n christmasEve: {\n date: getChristmasEve(year),\n bankHoliday: false,\n federal: false,\n },\n columbusDay: {\n date: getColumbusDay(year),\n bankHoliday: true,\n federal: true,\n },\n easter: {\n date: getEaster(year),\n bankHoliday: false,\n federal: false,\n },\n fathersDay: {\n date: getFathersDay(year),\n bankHoliday: false,\n federal: false,\n },\n goodFriday: {\n date: getGoodFriday(year),\n bankHoliday: false,\n federal: false,\n },\n halloween: {\n date: getHalloween(year),\n bankHoliday: false,\n federal: false,\n },\n independenceDay: {\n date: getIndependenceDay(year),\n bankHoliday: true,\n federal: true,\n },\n juneteenth: {\n date: getJuneteenth(year),\n bankHoliday: !(year < 2022),\n federal: true,\n },\n laborDay: {\n date: getLaborDay(year),\n bankHoliday: true,\n federal: true,\n },\n martinLutherKingJrDay: {\n date: getMartinLutherKingJrDay(year),\n bankHoliday: true,\n federal: true,\n },\n memorialDay: {\n date: getMemorialDay(year),\n bankHoliday: true,\n federal: true,\n },\n mothersDay: {\n date: getMothersDay(year),\n bankHoliday: false,\n federal: false,\n },\n newYearsDay: {\n date: getNewYearsDay(year),\n bankHoliday: true,\n federal: true,\n },\n newYearsEve: {\n date: getNewYearsEve(year),\n bankHoliday: false,\n federal: false,\n },\n presidentsDay: {\n date: getPresidentsDay(year),\n bankHoliday: true,\n federal: false,\n },\n stPatricksDay: {\n date: getStPatricksDay(year),\n bankHoliday: false,\n federal: false,\n },\n thanksgiving: {\n date: getThanksgiving(year),\n bankHoliday: true,\n federal: true,\n },\n valentinesDay: {\n date: getValentinesDay(year),\n bankHoliday: false,\n federal: false,\n },\n veteransDay: {\n date: getVeteransDay(year),\n bankHoliday: true,\n federal: true,\n },\n };\n}\n","import { addDays, isSaturday, isSunday } from \"date-fns\";\nimport type { HolidayList } from \"../types\";\nimport { getHolidays } from \"./getHolidays\";\n\n/**\n * Returns the observed federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * This function adjusts federal holidays that fall on weekends to their\n * observed dates:\n * - Saturday holidays are observed on the preceding Friday\n * - Sunday holidays are observed on the following Monday\n *\n * Only holidays marked as `federal: true` are included in the result.\n *\n * @param year - The year for which to calculate observed holidays.\n * @returns A {@link HolidayList} containing observed federal holiday dates.\n */\nexport function getObservedHolidays(year: number): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (!holiday.federal) {\n continue;\n }\n\n if (isSaturday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, -1),\n };\n } else if (isSunday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, 1),\n };\n }\n }\n\n return result;\n}\n","import { getYear, isSameDay } from \"date-fns\";\nimport { getBankHolidays } from \"../holidays/getBankHolidays\";\nimport { getFederalHolidays } from \"../holidays/getFederalHolidays\";\nimport { getHolidays } from \"../holidays/getHolidays\";\nimport type { HolidayList } from \"../types\";\n\n/**\n * Determines whether a given {@link Date} exists within a {@link HolidayList} for its year.\n *\n * @category Utility\n *\n * @remarks\n * The function resolves the appropriate holiday list for the year of the provided\n * {@link Date}, then checks whether any holiday in that list matches the given date\n * using calendar-day comparison (time components are ignored).\n *\n * @param date - The {@link Date} to evaluate.\n * @param getHolidayList - Function that returns a {@link HolidayList} for a given year.\n * @returns `true` if the {@link Date} matches any entry in the holiday list; otherwise `false`.\n */\nexport function isInHolidayList(\n date: Date,\n getHolidayList: (year: number) => HolidayList,\n): boolean {\n const holidays = getHolidayList(getYear(date));\n\n return Object.values(holidays).some((holiday) =>\n isSameDay(date, holiday.date),\n );\n}\n\n/**\n * Checks whether a {@link Date} is any recognized holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a holiday.\n */\nexport function isHoliday(date: Date): boolean {\n return isInHolidayList(date, getHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a federal holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a federal holiday.\n */\nexport function isFederalHoliday(date: Date): boolean {\n return isInHolidayList(date, getFederalHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a bank holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a bank holiday.\n */\nexport function isBankHoliday(date: Date): boolean {\n return isInHolidayList(date, getBankHolidays);\n}\n"],"mappings":"kGAoBA,SAAgB,EAAmB,EAAY,EAAwB,CACrE,OAAO,GAAA,EAAA,EAAA,QAAA,CAAgC,EAAM,CAAC,EAAG,CAAc,CACjE,CAeA,SAAgB,EAAkB,EAAY,EAAwB,CAUpE,OATA,EAAA,EAAA,OAAA,CAAiB,CAAI,IAAM,IAI3B,AAGE,GAHF,EAAA,EAAA,OAAA,CAAiB,CAAI,EAAI,GACvB,EAAA,EAAA,QAAA,CAAe,EAAM,GAAA,EAAA,EAAA,OAAA,CAAiB,CAAI,EAAI,CAAc,GAE5D,EAAA,EAAA,QAAA,CAAe,EAAM,GAAA,EAAA,EAAA,OAAA,CAA8B,CAAI,CAAC,GANjD,CASX,CAeA,SAAgB,EAAkB,EAAY,EAAwB,CAUpE,OATA,EAAA,EAAA,OAAA,CAAiB,CAAI,IAAM,IAI3B,AAGE,GAHF,EAAA,EAAA,OAAA,CAAiB,CAAI,EAAI,GACvB,EAAA,EAAA,QAAA,CAAe,EAAM,KAAA,EAAA,EAAA,OAAA,CAAmB,CAAI,EAAI,EAAe,GAE/D,EAAA,EAAA,QAAA,CAAe,EAAM,KAAA,EAAA,EAAA,OAAA,CAAmB,CAAI,EAAI,GAAK,EAAI,GAAgB,GANlE,CASX,CAeA,SAAgB,EAAe,EAAY,EAAwB,CACjE,OAAO,GAAA,EAAA,EAAA,eAAA,CAA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Q,EAAY,CAAI,CAAC,EACvD,EAAQ,WAIb,EAAA,EAAA,WAAA,CAAe,EAAQ,IAAI,EACzB,EAAO,GAAQ,CACb,MAAA,EAAA,EAAA,QAAA,CAAc,EAAQ,KAAM,EAAE,CAChC,GACK,EAAA,EAAA,SAAA,CAAa,EAAQ,IAAI,IAC9B,EAAO,GAAQ,CACb,MAAA,EAAA,EAAA,QAAA,CAAc,EAAQ,KAAM,CAAC,CAC/B,IAIJ,OAAO,CACT,CCpBA,SAAgB,EACd,EACA,EACS,CACT,IAAM,EAAW,GAAA,EAAA,EAAA,QAAA,CAAuB,CAAI,CAAC,EAE7C,OAAO,OAAO,OAAO,CAAQ,CAAC,CAAC,KAAM,IAAA,EAAA,EAAA,UAAA,CACzB,EAAM,EAAQ,IAAI,CAC9B,CACF,CAUA,SAAgB,EAAU,EAAqB,CAC7C,OAAO,EAAgB,EAAM,CAAW,CAC1C,CAUA,SAAgB,EAAiB,EAAqB,CACpD,OAAO,EAAgB,EAAM,CAAkB,CACjD,CAUA,SAAgB,EAAc,EAAqB,CACjD,OAAO,EAAgB,EAAM,CAAe,CAC9C"}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{addDays as e,addWeeks as t,getDay as n,getYear as r,isSameDay as i,isSaturday as a,isSunday as o,lastDayOfMonth as s,setDate as c}from"date-fns";function l(e,t){return u(c(e,1),t)}function u(t,r){return n(t)===r||(t=n(t)>r?e(t,7-n(t)+r):e(t,r-n(t))),t}function d(t,r){return n(t)===r||(t=n(t)>r?e(t,-1*(n(t)-r)):e(t,-1*(n(t)-0+(7-r)))),t}function f(e,t){return d(s(e),t)}function p(e){return t(l(new Date(e,10),4),3)}function m(t){return e(p(t),1)}function h(e){return new Date(e,11,26)}function g(e){return new Date(e,11,25)}function _(e){return new Date(e,11,24)}function v(e){return t(l(new Date(e,9),1),1)}function y(e){if(e<325)throw RangeError(`Cannot calculate Easter dates before 325 AD.`);function t(e,t){return e%t}function n(e,t){let n=e/t;if(n<0)throw Error(`Unexpected negative q`);return Math.floor(n)}let r=e,i=t(r,19),a=n(r,100),o=t(r,100),s=n(a,4),c=t(a,4),l=n(a-n(a+8,25)+1,3),u=t(19*i+a-s-l+15,30),d=n(o,4),f=t(o,4),p=t(32+2*c+2*d-u-f,7),m=n(i+11*u+22*p,451),h=u+p-7*m+21,g=n(h,31)+3,_=t(h,31);return new Date(e,g-1,_+1)}function b(e){return t(l(new Date(e,5),0),2)}function x(t){return e(y(t),-2)}function S(e){return new Date(e,9,31)}function C(e){return new Date(e,6,4)}function w(e){return new Date(e,5,19)}function T(e){return l(new Date(e,8),1)}function E(e){return t(l(new Date(e,0),1),2)}function D(e){return f(new Date(e,4),1)}function O(e){return t(l(new Date(e,4),0),1)}function k(e){return new Date(e,0,1)}function A(e){return s(new Date(e,11))}function j(e){return t(l(new Date(e,1),1),2)}function M(e){return new Date(e,2,17)}function N(e){return new Date(e,1,14)}function P(e){return new Date(e,10,11)}function F(e,t){let n={};for(let[r,i]of Object.entries(R(e)))t(i)&&(n[r]={date:i.date});return n}function I(e){return F(e,e=>e.bankHoliday)}function L(e){return F(e,e=>e.federal)}function R(e){return{blackFriday:{date:m(e),bankHoliday:!1,federal:!1},boxingDay:{date:h(e),bankHoliday:!1,federal:!1},christmas:{date:g(e),bankHoliday:!0,federal:!0},christmasEve:{date:_(e),bankHoliday:!1,federal:!1},columbusDay:{date:v(e),bankHoliday:!0,federal:!0},easter:{date:y(e),bankHoliday:!1,federal:!1},fathersDay:{date:b(e),bankHoliday:!1,federal:!1},goodFriday:{date:x(e),bankHoliday:!1,federal:!1},halloween:{date:S(e),bankHoliday:!1,federal:!1},independenceDay:{date:C(e),bankHoliday:!0,federal:!0},juneteenth:{date:w(e),bankHoliday:!(e<2022),federal:!0},laborDay:{date:T(e),bankHoliday:!0,federal:!0},martinLutherKingJrDay:{date:E(e),bankHoliday:!0,federal:!0},memorialDay:{date:D(e),bankHoliday:!0,federal:!0},mothersDay:{date:O(e),bankHoliday:!1,federal:!1},newYearsDay:{date:k(e),bankHoliday:!0,federal:!0},newYearsEve:{date:A(e),bankHoliday:!1,federal:!1},presidentsDay:{date:j(e),bankHoliday:!0,federal:!1},stPatricksDay:{date:M(e),bankHoliday:!1,federal:!1},thanksgiving:{date:p(e),bankHoliday:!0,federal:!0},valentinesDay:{date:N(e),bankHoliday:!1,federal:!1},veteransDay:{date:P(e),bankHoliday:!0,federal:!0}}}function z(t){let n={};for(let[r,i]of Object.entries(R(t)))i.federal&&(a(i.date)?n[r]={date:e(i.date,-1)}:o(i.date)&&(n[r]={date:e(i.date,1)}));return n}function B(e,t){let n=t(r(e));return Object.values(n).some(t=>i(e,t.date))}function V(e){return B(e,R)}function H(e){return B(e,L)}function U(e){return B(e,I)}export{F as filterHolidays,I as getBankHolidays,m as getBlackFriday,h as getBoxingDay,g as getChristmas,_ as getChristmasEve,v as getColumbusDay,y as getEaster,b as getFathersDay,L as getFederalHolidays,l as getFirstOccurrence,x as getGoodFriday,S as getHalloween,R as getHolidays,C as getIndependenceDay,w as getJuneteenth,T as getLaborDay,f as getLastOfMonth,E as getMartinLutherKingJrDay,D as getMemorialDay,O as getMothersDay,k as getNewYearsDay,A as getNewYearsEve,u as getNextOccurrence,z as getObservedHolidays,j as getPresidentsDay,d as getPrevOccurrence,M as getStPatricksDay,p as getThanksgiving,N as getValentinesDay,P as getVeteransDay,U as isBankHoliday,H as isFederalHoliday,V as isHoliday,B as isInHolidayList};
1
+ import{addDays as e,addWeeks as t,getDay as n,getYear as r,isSameDay as i,isSaturday as a,isSunday as o,lastDayOfMonth as s,setDate as c}from"date-fns";function l(e,t){return u(c(e,1),t)}function u(t,r){return n(t)===r||(t=n(t)>r?e(t,7-n(t)+r):e(t,r-n(t))),t}function d(t,r){return n(t)===r||(t=n(t)>r?e(t,-1*(n(t)-r)):e(t,-1*(n(t)-0+(7-r)))),t}function f(e,t){return d(s(e),t)}function p(e){return t(l(new Date(e,10),4),3)}function m(t){return e(p(t),1)}function h(e){return new Date(e,11,26)}function g(e){return new Date(e,11,25)}function _(e){return g(e)}function v(e){return new Date(e,11,24)}function y(e){return t(l(new Date(e,9),1),1)}function b(e){if(e<325)throw RangeError(`Cannot calculate Easter dates before 325 AD.`);function t(e,t){return e%t}function n(e,t){let n=e/t;if(n<0)throw Error(`Unexpected negative q`);return Math.floor(n)}let r=e,i=t(r,19),a=n(r,100),o=t(r,100),s=n(a,4),c=t(a,4),l=n(a-n(a+8,25)+1,3),u=t(19*i+a-s-l+15,30),d=n(o,4),f=t(o,4),p=t(32+2*c+2*d-u-f,7),m=n(i+11*u+22*p,451),h=u+p-7*m+21,g=n(h,31)+3,_=t(h,31);return new Date(e,g-1,_+1)}function x(e){return t(l(new Date(e,5),0),2)}function S(t){return e(b(t),-2)}function C(e){return new Date(e,9,31)}function w(e){return new Date(e,6,4)}function T(e){return new Date(e,5,19)}function E(e){return l(new Date(e,8),1)}function D(e){return t(l(new Date(e,0),1),2)}function O(e){return f(new Date(e,4),1)}function k(e){return t(l(new Date(e,4),0),1)}function A(e){return new Date(e,0,1)}function j(e){return s(new Date(e,11))}function M(e){return t(l(new Date(e,1),1),2)}function N(e){return new Date(e,2,17)}function P(e){return new Date(e,1,14)}function F(e){return new Date(e,10,11)}function I(e,t){let n={};for(let[r,i]of Object.entries(z(e)))t(i)&&(n[r]={date:i.date});return n}function L(e){return I(e,e=>e.bankHoliday)}function R(e){return I(e,e=>e.federal)}function z(e){return{blackFriday:{date:m(e),bankHoliday:!1,federal:!1},boxingDay:{date:h(e),bankHoliday:!1,federal:!1},christmas:{date:_(e),bankHoliday:!0,federal:!0},christmasDay:{date:g(e),bankHoliday:!0,federal:!0},christmasEve:{date:v(e),bankHoliday:!1,federal:!1},columbusDay:{date:y(e),bankHoliday:!0,federal:!0},easter:{date:b(e),bankHoliday:!1,federal:!1},fathersDay:{date:x(e),bankHoliday:!1,federal:!1},goodFriday:{date:S(e),bankHoliday:!1,federal:!1},halloween:{date:C(e),bankHoliday:!1,federal:!1},independenceDay:{date:w(e),bankHoliday:!0,federal:!0},juneteenth:{date:T(e),bankHoliday:!(e<2022),federal:!0},laborDay:{date:E(e),bankHoliday:!0,federal:!0},martinLutherKingJrDay:{date:D(e),bankHoliday:!0,federal:!0},memorialDay:{date:O(e),bankHoliday:!0,federal:!0},mothersDay:{date:k(e),bankHoliday:!1,federal:!1},newYearsDay:{date:A(e),bankHoliday:!0,federal:!0},newYearsEve:{date:j(e),bankHoliday:!1,federal:!1},presidentsDay:{date:M(e),bankHoliday:!0,federal:!1},stPatricksDay:{date:N(e),bankHoliday:!1,federal:!1},thanksgiving:{date:p(e),bankHoliday:!0,federal:!0},valentinesDay:{date:P(e),bankHoliday:!1,federal:!1},veteransDay:{date:F(e),bankHoliday:!0,federal:!0}}}function B(t){let n={};for(let[r,i]of Object.entries(z(t)))i.federal&&(a(i.date)?n[r]={date:e(i.date,-1)}:o(i.date)&&(n[r]={date:e(i.date,1)}));return n}function V(e,t){let n=t(r(e));return Object.values(n).some(t=>i(e,t.date))}function H(e){return V(e,z)}function U(e){return V(e,R)}function W(e){return V(e,L)}export{I as filterHolidays,L as getBankHolidays,m as getBlackFriday,h as getBoxingDay,_ as getChristmas,g as getChristmasDay,v as getChristmasEve,y as getColumbusDay,b as getEaster,x as getFathersDay,R as getFederalHolidays,l as getFirstOccurrence,S as getGoodFriday,C as getHalloween,z as getHolidays,w as getIndependenceDay,T as getJuneteenth,E as getLaborDay,f as getLastOfMonth,D as getMartinLutherKingJrDay,O as getMemorialDay,k as getMothersDay,A as getNewYearsDay,j as getNewYearsEve,u as getNextOccurrence,B as getObservedHolidays,M as getPresidentsDay,d as getPrevOccurrence,N as getStPatricksDay,p as getThanksgiving,P as getValentinesDay,F as getVeteransDay,W as isBankHoliday,U as isFederalHoliday,H as isHoliday,V as isInHolidayList};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["setDayOfMonth","getDayOfWeek"],"sources":["../src/utils/getters.ts","../src/holiday/getThanksgiving.ts","../src/holiday/getBlackFriday.ts","../src/holiday/getBoxingDay.ts","../src/holiday/getChristmas.ts","../src/holiday/getChristmasEve.ts","../src/holiday/getColumbusDay.ts","../src/holiday/getEaster.ts","../src/holiday/getFathersDay.ts","../src/holiday/getGoodFriday.ts","../src/holiday/getHalloween.ts","../src/holiday/getIndependenceDay.ts","../src/holiday/getJuneteenth.ts","../src/holiday/getLaborDay.ts","../src/holiday/getMartinLutherKingJrDay.ts","../src/holiday/getMemorialDay.ts","../src/holiday/getMothersDay.ts","../src/holiday/getNewYearsDay.ts","../src/holiday/getNewYearsEve.ts","../src/holiday/getPresidentsDay.ts","../src/holiday/getStPatricksDay.ts","../src/holiday/getValentinesDay.ts","../src/holiday/getVeteransDay.ts","../src/utils/filters.ts","../src/holidays/getBankHolidays.ts","../src/holidays/getFederalHolidays.ts","../src/holidays/getHolidays.ts","../src/holidays/getObservedHolidays.ts","../src/utils/isIn.ts"],"sourcesContent":["import {\n addDays,\n getDay as getDayOfWeek,\n lastDayOfMonth,\n setDate as setDayOfMonth,\n} from \"date-fns\";\n\n/**\n * Returns the first occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This works by normalizing the date to the first day of its month, then finding the\n * next occurrence of the specified weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the first occurrence of the weekday in that month.\n */\nexport function getFirstOccurrence(date: Date, dayOfWeekIndex: number) {\n return getNextOccurrence(setDayOfMonth(date, 1), dayOfWeekIndex);\n}\n\n/**\n * Returns the next occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function advances forward to the next matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the next occurrence of the weekday.\n */\nexport function getNextOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, 7 - getDayOfWeek(date) + dayOfWeekIndex);\n } else {\n date = addDays(date, dayOfWeekIndex - getDayOfWeek(date));\n }\n return date;\n}\n\n/**\n * Returns the previous occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function moves backward to the previous matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the previous occurrence of the weekday.\n */\nexport function getPrevOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, -1 * (getDayOfWeek(date) - dayOfWeekIndex));\n } else {\n date = addDays(date, -1 * (getDayOfWeek(date) - 0 + (7 - dayOfWeekIndex)));\n }\n return date;\n}\n\n/**\n * Returns the last occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This is computed by starting at the last day of the month and walking backwards\n * to the requested weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the last occurrence of the weekday in the month.\n */\nexport function getLastOfMonth(date: Date, dayOfWeekIndex: number) {\n return getPrevOccurrence(lastDayOfMonth(date), dayOfWeekIndex);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Thanksgiving for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Thanksgiving is observed on the fourth Thursday of November.\n *\n * @param year - The year for which to calculate Thanksgiving.\n * @returns A {@link Date} representing Thanksgiving in the specified year.\n */\nexport function getThanksgiving(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 10), 4), 3);\n}\n","import { addDays } from \"date-fns\";\nimport { getThanksgiving } from \"./getThanksgiving\";\n\n/**\n * Returns the date of Black Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Black Friday is observed annually on the day after Thanksgiving Day\n * in the United States (the fourth Friday of November).\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Black Friday.\n * @returns A {@link Date} representing Black Friday of the specified year.\n */\nexport function getBlackFriday(year: number) {\n return addDays(getThanksgiving(year), 1);\n}\n","/**\n * Returns the date of Boxing Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Boxing Day is observed on December 26 in several Commonwealth countries,\n * including the UK, Canada, Australia, and New Zealand.\n *\n * It is not a U.S. federal holiday, but it is a fixed calendar date\n * immediately following Christmas Day.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Boxing Day.\n * @returns A {@link Date} representing December 26 of the specified year.\n */\nexport function getBoxingDay(year: number) {\n return new Date(year, 11, 26);\n}\n","/**\n * Returns the date of Christmas Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Day is observed annually on December 25.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Day.\n * @returns A {@link Date} representing December 25 of the specified year.\n */\nexport function getChristmas(year: number) {\n return new Date(year, 11, 25);\n}\n","/**\n * Returns the date of Christmas Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Eve is observed annually on December 24.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Eve.\n * @returns A {@link Date} representing December 24 of the specified year.\n */\nexport function getChristmasEve(year: number) {\n return new Date(year, 11, 24);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Columbus Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Columbus Day is observed on the second Monday\n * of October.\n *\n * @param year - The year for which to calculate Columbus Day.\n * @returns A {@link Date} representing the second Monday in October.\n */\nexport function getColumbusDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 9), 1), 1);\n}\n","/**\n * Calculates the date of Easter Sunday for a given year using the\n * Gregorian computus algorithm.\n *\n * @category Holiday\n *\n * @remarks\n * This implementation is valid for years from 325 AD onward, the year of the\n * First Council of Nicaea, which established the basis for calculating Easter.\n *\n * The returned {@link Date} is created in the local time zone and represents\n * Easter Sunday for the specified year.\n *\n * @param year - The year for which to calculate Easter Sunday.\n * @returns A {@link Date} representing Easter Sunday in the specified year.\n * @throws {RangeError} Thrown if the year is earlier than 325 AD.\n */\nexport function getEaster(year: number) {\n if (year < 325) {\n throw new RangeError(\"Cannot calculate Easter dates before 325 AD.\");\n }\n\n /**\n * Computes the remainder of a division operation.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The remainder of `a / b`.\n */\n function mod(a: number, b: number) {\n return a % b;\n }\n\n /**\n * Performs integer division by truncating toward negative infinity.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The integer quotient of `a / b`.\n * @throws {Error} Thrown if an unexpected negative quotient is produced.\n */\n function div(a: number, b: number) {\n const q = a / b;\n /* v8 ignore next */\n if (q < 0) {\n throw new Error(\"Unexpected negative q\");\n }\n return Math.floor(q);\n }\n\n const y = year,\n skipMarchDays = 21,\n a = mod(y, 19),\n b = div(y, 100),\n c = mod(y, 100),\n d = div(b, 4),\n e = mod(b, 4),\n f = div(b + 8, 25),\n g = div(b - f + 1, 3),\n h = mod(19 * a + b - d - g + 15, 30),\n i = div(c, 4),\n k = mod(c, 4),\n l = mod(32 + 2 * e + 2 * i - h - k, 7),\n m = div(a + 11 * h + 22 * l, 451),\n t = h + l - 7 * m + skipMarchDays,\n n = div(t, 31) + 3,\n p = mod(t, 31);\n\n return new Date(year, n - 1, p + 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Father's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States and many other countries, Father's Day is observed on\n * the third Sunday of June.\n *\n * @param year - The year for which to calculate Father's Day.\n * @returns A {@link Date} representing the third Sunday in June.\n */\nexport function getFathersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 5), 0), 2);\n}\n","import { addDays } from \"date-fns\";\nimport { getEaster } from \"./getEaster\";\n\n/**\n * Calculates the date of Good Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Good Friday is observed two days before Easter Sunday and commemorates the\n * crucifixion of Jesus Christ in Christian tradition.\n *\n * @param year - The year for which to calculate Good Friday.\n * @returns A {@link Date} representing Good Friday in the specified year.\n */\nexport function getGoodFriday(year: number) {\n return addDays(getEaster(year), -2);\n}\n","/**\n * Returns the date of Halloween for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Halloween is observed annually on October 31.\n *\n * @param year - The year for which to obtain Halloween.\n * @returns A {@link Date} representing October 31 of the specified year.\n */\nexport function getHalloween(year: number) {\n return new Date(year, 9, 31);\n}\n","/**\n * Returns the date of Independence Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Independence Day in the United States is observed annually on July 4.\n *\n * @param year - The year for which to obtain Independence Day.\n * @returns A {@link Date} representing July 4 of the specified year.\n */\nexport function getIndependenceDay(year: number) {\n return new Date(year, 6, 4);\n}\n","/**\n * Returns the date of Juneteenth for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Juneteenth National Independence Day is observed in the United States on June 19.\n * It became a federal holiday in 2021.\n *\n * @param year - The year for which to obtain Juneteenth.\n * @returns A {@link Date} representing June 19 of the specified year.\n */\nexport function getJuneteenth(year: number) {\n return new Date(year, 5, 19);\n}\n","import { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Labor Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Labor Day is observed on the first Monday of September.\n *\n * @param year - The year for which to calculate Labor Day.\n * @returns A {@link Date} representing Labor Day in the specified year.\n */\nexport function getLaborDay(year: number) {\n return getFirstOccurrence(new Date(year, 8), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Martin Luther King Jr. Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Martin Luther King Jr. Day is observed on the third Monday of January.\n *\n * @param year - The year for which to calculate the holiday.\n * @returns A {@link Date} representing Martin Luther King Jr. Day in the specified year.\n */\nexport function getMartinLutherKingJrDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 0), 1), 2);\n}\n","import { getLastOfMonth } from \"../utils/getters\";\n\n/**\n * Returns the date of Memorial Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Memorial Day is observed on the last Monday of May.\n *\n * @param year - The year for which to calculate Memorial Day.\n * @returns A {@link Date} representing Memorial Day in the specified year.\n */\nexport function getMemorialDay(year: number) {\n return getLastOfMonth(new Date(year, 4), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Mother's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Mother's Day is observed on the second Sunday of May.\n *\n * @param year - The year for which to calculate Mother's Day.\n * @returns A {@link Date} representing Mother's Day in the specified year.\n */\nexport function getMothersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 4), 0), 1);\n}\n","/**\n * Returns the date of New Year's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Day is observed annually on January 1.\n *\n * @param year - The year for which to obtain New Year's Day.\n * @returns A {@link Date} representing January 1 of the specified year.\n */\nexport function getNewYearsDay(year: number) {\n return new Date(year, 0, 1);\n}\n","import { lastDayOfMonth } from \"date-fns\";\n\n/**\n * Returns the date of New Year's Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Eve is the last day of the year, observed on December 31.\n *\n * @param year - The year for which to obtain New Year's Eve.\n * @returns A {@link Date} representing December 31 of the specified year.\n */\nexport function getNewYearsEve(year: number) {\n return lastDayOfMonth(new Date(year, 11));\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Presidents Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Presidents Day is observed on the third Monday of February.\n *\n * @param year - The year for which to calculate Presidents Day.\n * @returns A {@link Date} representing Presidents Day in the specified year.\n */\nexport function getPresidentsDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 1), 1), 2);\n}\n","/**\n * Returns the date of St. Patrick's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * St. Patrick's Day is observed annually on March 17.\n *\n * It is not a U.S. federal holiday, but is widely celebrated culturally,\n * particularly in the United States and Ireland.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain St. Patrick's Day.\n * @returns A {@link Date} representing March 17 of the specified year.\n */\nexport function getStPatricksDay(year: number) {\n return new Date(year, 2, 17);\n}\n","/**\n * Returns the date of Valentine's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Valentine's Day is observed annually on February 14.\n *\n * @param year - The year for which to obtain Valentine's Day.\n * @returns A {@link Date} representing February 14 of the specified year.\n */\nexport function getValentinesDay(year: number) {\n return new Date(year, 1, 14);\n}\n","/**\n * Returns the date of Veterans Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Veterans Day is observed annually on November 11 in the United States.\n *\n * @param year - The year for which to obtain Veterans Day.\n * @returns A {@link Date} representing November 11 of the specified year.\n */\nexport function getVeteransDay(year: number) {\n return new Date(year, 10, 11);\n}\n","import { getHolidays } from \"../holidays\";\nimport type { Holiday, HolidayList, Holidays } from \"../types\";\n\n/**\n * Filters the full holiday set for a given year using a predicate.\n *\n * @category Utility\n *\n * @remarks\n * This function evaluates the complete {@link Holidays} object returned by\n * {@link getHolidays} and constructs a {@link HolidayList} containing only\n * entries that satisfy the provided predicate.\n *\n * The resulting object preserves the original holiday keys but reduces each\n * entry to its date value.\n *\n * @param year - The year for which to retrieve and filter holidays.\n * @param predicate - Function applied to each holiday entry to determine inclusion.\n * @returns A {@link HolidayList} containing only matching holidays.\n */\nexport function filterHolidays(\n year: number,\n predicate: (holiday: Holidays[Holiday]) => boolean,\n): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (predicate(holiday)) {\n result[name] = {\n date: holiday.date,\n };\n }\n }\n\n return result;\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all bank holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as bank holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve bank holidays.\n * @returns A {@link HolidayList} of bank holidays occurring in the specified year.\n */\nexport function getBankHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.bankHoliday);\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as federal holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve federal holidays.\n * @returns A {@link HolidayList} of federal holidays occurring in the specified year.\n */\nexport function getFederalHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.federal);\n}\n","import { getBlackFriday } from \"../holiday/getBlackFriday\";\nimport { getBoxingDay } from \"../holiday/getBoxingDay\";\nimport { getChristmas } from \"../holiday/getChristmas\";\nimport { getChristmasEve } from \"../holiday/getChristmasEve\";\nimport { getColumbusDay } from \"../holiday/getColumbusDay\";\nimport { getEaster } from \"../holiday/getEaster\";\nimport { getFathersDay } from \"../holiday/getFathersDay\";\nimport { getGoodFriday } from \"../holiday/getGoodFriday\";\nimport { getHalloween } from \"../holiday/getHalloween\";\nimport { getIndependenceDay } from \"../holiday/getIndependenceDay\";\nimport { getJuneteenth } from \"../holiday/getJuneteenth\";\nimport { getLaborDay } from \"../holiday/getLaborDay\";\nimport { getMartinLutherKingJrDay } from \"../holiday/getMartinLutherKingJrDay\";\nimport { getMemorialDay } from \"../holiday/getMemorialDay\";\nimport { getMothersDay } from \"../holiday/getMothersDay\";\nimport { getNewYearsDay } from \"../holiday/getNewYearsDay\";\nimport { getNewYearsEve } from \"../holiday/getNewYearsEve\";\nimport { getPresidentsDay } from \"../holiday/getPresidentsDay\";\nimport { getStPatricksDay } from \"../holiday/getStPatricksDay\";\nimport { getThanksgiving } from \"../holiday/getThanksgiving\";\nimport { getValentinesDay } from \"../holiday/getValentinesDay\";\nimport { getVeteransDay } from \"../holiday/getVeteransDay\";\nimport type { Holidays } from \"../types\";\n\n/**\n * Returns the complete set of supported holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Each holiday entry contains its calculated date together with metadata\n * indicating whether it is recognized as a federal holiday and/or a bank\n * holiday.\n *\n * Holiday observance classifications may vary by jurisdiction and may change\n * over time. The values returned by this function reflect the rules implemented\n * by this library.\n *\n * @param year - The year for which to generate holiday information.\n * @returns An object containing all supported holidays and their metadata.\n */\nexport function getHolidays(year: number): Holidays {\n return {\n blackFriday: {\n date: getBlackFriday(year),\n bankHoliday: false,\n federal: false,\n },\n boxingDay: {\n date: getBoxingDay(year),\n bankHoliday: false,\n federal: false,\n },\n christmas: {\n date: getChristmas(year),\n bankHoliday: true,\n federal: true,\n },\n christmasEve: {\n date: getChristmasEve(year),\n bankHoliday: false,\n federal: false,\n },\n columbusDay: {\n date: getColumbusDay(year),\n bankHoliday: true,\n federal: true,\n },\n easter: {\n date: getEaster(year),\n bankHoliday: false,\n federal: false,\n },\n fathersDay: {\n date: getFathersDay(year),\n bankHoliday: false,\n federal: false,\n },\n goodFriday: {\n date: getGoodFriday(year),\n bankHoliday: false,\n federal: false,\n },\n halloween: {\n date: getHalloween(year),\n bankHoliday: false,\n federal: false,\n },\n independenceDay: {\n date: getIndependenceDay(year),\n bankHoliday: true,\n federal: true,\n },\n juneteenth: {\n date: getJuneteenth(year),\n bankHoliday: !(year < 2022),\n federal: true,\n },\n laborDay: {\n date: getLaborDay(year),\n bankHoliday: true,\n federal: true,\n },\n martinLutherKingJrDay: {\n date: getMartinLutherKingJrDay(year),\n bankHoliday: true,\n federal: true,\n },\n memorialDay: {\n date: getMemorialDay(year),\n bankHoliday: true,\n federal: true,\n },\n mothersDay: {\n date: getMothersDay(year),\n bankHoliday: false,\n federal: false,\n },\n newYearsDay: {\n date: getNewYearsDay(year),\n bankHoliday: true,\n federal: true,\n },\n newYearsEve: {\n date: getNewYearsEve(year),\n bankHoliday: false,\n federal: false,\n },\n presidentsDay: {\n date: getPresidentsDay(year),\n bankHoliday: true,\n federal: false,\n },\n stPatricksDay: {\n date: getStPatricksDay(year),\n bankHoliday: false,\n federal: false,\n },\n thanksgiving: {\n date: getThanksgiving(year),\n bankHoliday: true,\n federal: true,\n },\n valentinesDay: {\n date: getValentinesDay(year),\n bankHoliday: false,\n federal: false,\n },\n veteransDay: {\n date: getVeteransDay(year),\n bankHoliday: true,\n federal: true,\n },\n };\n}\n","import { addDays, isSaturday, isSunday } from \"date-fns\";\nimport type { HolidayList } from \"../types\";\nimport { getHolidays } from \"./getHolidays\";\n\n/**\n * Returns the observed federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * This function adjusts federal holidays that fall on weekends to their\n * observed dates:\n * - Saturday holidays are observed on the preceding Friday\n * - Sunday holidays are observed on the following Monday\n *\n * Only holidays marked as `federal: true` are included in the result.\n *\n * @param year - The year for which to calculate observed holidays.\n * @returns A {@link HolidayList} containing observed federal holiday dates.\n */\nexport function getObservedHolidays(year: number): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (!holiday.federal) {\n continue;\n }\n\n if (isSaturday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, -1),\n };\n } else if (isSunday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, 1),\n };\n }\n }\n\n return result;\n}\n","import { getYear, isSameDay } from \"date-fns\";\nimport { getBankHolidays } from \"../holidays/getBankHolidays\";\nimport { getFederalHolidays } from \"../holidays/getFederalHolidays\";\nimport { getHolidays } from \"../holidays/getHolidays\";\nimport type { HolidayList } from \"../types\";\n\n/**\n * Determines whether a given {@link Date} exists within a {@link HolidayList} for its year.\n *\n * @category Utility\n *\n * @remarks\n * The function resolves the appropriate holiday list for the year of the provided\n * {@link Date}, then checks whether any holiday in that list matches the given date\n * using calendar-day comparison (time components are ignored).\n *\n * @param date - The {@link Date} to evaluate.\n * @param getHolidayList - Function that returns a {@link HolidayList} for a given year.\n * @returns `true` if the {@link Date} matches any entry in the holiday list; otherwise `false`.\n */\nexport function isInHolidayList(\n date: Date,\n getHolidayList: (year: number) => HolidayList,\n): boolean {\n const holidays = getHolidayList(getYear(date));\n\n return Object.values(holidays).some((holiday) =>\n isSameDay(date, holiday.date),\n );\n}\n\n/**\n * Checks whether a {@link Date} is any recognized holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a holiday.\n */\nexport function isHoliday(date: Date): boolean {\n return isInHolidayList(date, getHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a federal holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a federal holiday.\n */\nexport function isFederalHoliday(date: Date): boolean {\n return isInHolidayList(date, getFederalHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a bank holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a bank holiday.\n */\nexport function isBankHoliday(date: Date): boolean {\n return isInHolidayList(date, getBankHolidays);\n}\n"],"mappings":"wJAoBA,SAAgB,EAAmB,EAAY,EAAwB,CACrE,OAAO,EAAkBA,EAAc,EAAM,CAAC,EAAG,CAAc,CACjE,CAeA,SAAgB,EAAkB,EAAY,EAAwB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Aa,CACX,KAAM,EAAe,CAAI,EACzB,YAAa,GACb,QAAS,EACX,CACF,CACF,CCtIA,SAAgB,EAAoB,EAA2B,CAC7D,IAAM,EAAsB,CAAC,EAE7B,IAAK,GAAM,CAAC,EAAM,KAAY,OAAO,QAAQ,EAAY,CAAI,CAAC,EACvD,EAAQ,UAIT,EAAW,EAAQ,IAAI,EACzB,EAAO,GAAQ,CACb,KAAM,EAAQ,EAAQ,KAAM,EAAE,CAChC,EACS,EAAS,EAAQ,IAAI,IAC9B,EAAO,GAAQ,CACb,KAAM,EAAQ,EAAQ,KAAM,CAAC,CAC/B,IAIJ,OAAO,CACT,CCpBA,SAAgB,EACd,EACA,EACS,CACT,IAAM,EAAW,EAAe,EAAQ,CAAI,CAAC,EAE7C,OAAO,OAAO,OAAO,CAAQ,CAAC,CAAC,KAAM,GACnC,EAAU,EAAM,EAAQ,IAAI,CAC9B,CACF,CAUA,SAAgB,EAAU,EAAqB,CAC7C,OAAO,EAAgB,EAAM,CAAW,CAC1C,CAUA,SAAgB,EAAiB,EAAqB,CACpD,OAAO,EAAgB,EAAM,CAAkB,CACjD,CAUA,SAAgB,EAAc,EAAqB,CACjD,OAAO,EAAgB,EAAM,CAAe,CAC9C"}
1
+ {"version":3,"file":"index.mjs","names":["setDayOfMonth","getDayOfWeek"],"sources":["../src/utils/getters.ts","../src/holiday/getThanksgiving.ts","../src/holiday/getBlackFriday.ts","../src/holiday/getBoxingDay.ts","../src/holiday/getChristmasDay.ts","../src/holiday/getChristmas.ts","../src/holiday/getChristmasEve.ts","../src/holiday/getColumbusDay.ts","../src/holiday/getEaster.ts","../src/holiday/getFathersDay.ts","../src/holiday/getGoodFriday.ts","../src/holiday/getHalloween.ts","../src/holiday/getIndependenceDay.ts","../src/holiday/getJuneteenth.ts","../src/holiday/getLaborDay.ts","../src/holiday/getMartinLutherKingJrDay.ts","../src/holiday/getMemorialDay.ts","../src/holiday/getMothersDay.ts","../src/holiday/getNewYearsDay.ts","../src/holiday/getNewYearsEve.ts","../src/holiday/getPresidentsDay.ts","../src/holiday/getStPatricksDay.ts","../src/holiday/getValentinesDay.ts","../src/holiday/getVeteransDay.ts","../src/utils/filters.ts","../src/holidays/getBankHolidays.ts","../src/holidays/getFederalHolidays.ts","../src/holidays/getHolidays.ts","../src/holidays/getObservedHolidays.ts","../src/utils/isIn.ts"],"sourcesContent":["import {\n addDays,\n getDay as getDayOfWeek,\n lastDayOfMonth,\n setDate as setDayOfMonth,\n} from \"date-fns\";\n\n/**\n * Returns the first occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This works by normalizing the date to the first day of its month, then finding the\n * next occurrence of the specified weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the first occurrence of the weekday in that month.\n */\nexport function getFirstOccurrence(date: Date, dayOfWeekIndex: number) {\n return getNextOccurrence(setDayOfMonth(date, 1), dayOfWeekIndex);\n}\n\n/**\n * Returns the next occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function advances forward to the next matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the next occurrence of the weekday.\n */\nexport function getNextOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, 7 - getDayOfWeek(date) + dayOfWeekIndex);\n } else {\n date = addDays(date, dayOfWeekIndex - getDayOfWeek(date));\n }\n return date;\n}\n\n/**\n * Returns the previous occurrence of a given weekday relative to a date.\n *\n * @category Utility\n *\n * @remarks\n * If the provided date already matches the target weekday, it is returned unchanged.\n * Otherwise, the function moves backward to the previous matching weekday.\n *\n * @param date - Starting date.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the previous occurrence of the weekday.\n */\nexport function getPrevOccurrence(date: Date, dayOfWeekIndex: number) {\n if (getDayOfWeek(date) === dayOfWeekIndex) {\n return date;\n }\n\n if (getDayOfWeek(date) > dayOfWeekIndex) {\n date = addDays(date, -1 * (getDayOfWeek(date) - dayOfWeekIndex));\n } else {\n date = addDays(date, -1 * (getDayOfWeek(date) - 0 + (7 - dayOfWeekIndex)));\n }\n return date;\n}\n\n/**\n * Returns the last occurrence of a given weekday within the month of the provided date.\n *\n * @category Utility\n *\n * @remarks\n * This is computed by starting at the last day of the month and walking backwards\n * to the requested weekday.\n *\n * @param date - Any date within the target month.\n * @param dayOfWeekIndex - Weekday index (0 = Sunday, 6 = Saturday).\n * @returns A {@link Date} representing the last occurrence of the weekday in the month.\n */\nexport function getLastOfMonth(date: Date, dayOfWeekIndex: number) {\n return getPrevOccurrence(lastDayOfMonth(date), dayOfWeekIndex);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Thanksgiving for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Thanksgiving is observed on the fourth Thursday of November.\n *\n * @param year - The year for which to calculate Thanksgiving.\n * @returns A {@link Date} representing Thanksgiving in the specified year.\n */\nexport function getThanksgiving(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 10), 4), 3);\n}\n","import { addDays } from \"date-fns\";\nimport { getThanksgiving } from \"./getThanksgiving\";\n\n/**\n * Returns the date of Black Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Black Friday is observed annually on the day after Thanksgiving Day\n * in the United States (the fourth Friday of November).\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Black Friday.\n * @returns A {@link Date} representing Black Friday of the specified year.\n */\nexport function getBlackFriday(year: number) {\n return addDays(getThanksgiving(year), 1);\n}\n","/**\n * Returns the date of Boxing Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Boxing Day is observed on December 26 in several Commonwealth countries,\n * including the UK, Canada, Australia, and New Zealand.\n *\n * It is not a U.S. federal holiday, but it is a fixed calendar date\n * immediately following Christmas Day.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Boxing Day.\n * @returns A {@link Date} representing December 26 of the specified year.\n */\nexport function getBoxingDay(year: number) {\n return new Date(year, 11, 26);\n}\n","/**\n * Returns the date of Christmas Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Day is observed annually on December 25.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Day.\n * @returns A {@link Date} representing December 25 of the specified year.\n */\nexport function getChristmasDay(year: number) {\n return new Date(year, 11, 25);\n}\n","import { getChristmasDay } from \"./getChristmasDay\";\n\n/**\n * @deprecated Use {@link getChristmasDay} instead.\n *\n * @category Holiday\n *\n * @param year - The year for which to obtain Christmas Day.\n * @returns A {@link Date} representing December 25 of the specified year.\n */\nexport function getChristmas(year: number) {\n return getChristmasDay(year);\n}\n","/**\n * Returns the date of Christmas Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Christmas Eve is observed annually on December 24.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain Christmas Eve.\n * @returns A {@link Date} representing December 24 of the specified year.\n */\nexport function getChristmasEve(year: number) {\n return new Date(year, 11, 24);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Columbus Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Columbus Day is observed on the second Monday\n * of October.\n *\n * @param year - The year for which to calculate Columbus Day.\n * @returns A {@link Date} representing the second Monday in October.\n */\nexport function getColumbusDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 9), 1), 1);\n}\n","/**\n * Calculates the date of Easter Sunday for a given year using the\n * Gregorian computus algorithm.\n *\n * @category Holiday\n *\n * @remarks\n * This implementation is valid for years from 325 AD onward, the year of the\n * First Council of Nicaea, which established the basis for calculating Easter.\n *\n * The returned {@link Date} is created in the local time zone and represents\n * Easter Sunday for the specified year.\n *\n * @param year - The year for which to calculate Easter Sunday.\n * @returns A {@link Date} representing Easter Sunday in the specified year.\n * @throws {RangeError} Thrown if the year is earlier than 325 AD.\n */\nexport function getEaster(year: number) {\n if (year < 325) {\n throw new RangeError(\"Cannot calculate Easter dates before 325 AD.\");\n }\n\n /**\n * Computes the remainder of a division operation.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The remainder of `a / b`.\n */\n function mod(a: number, b: number) {\n return a % b;\n }\n\n /**\n * Performs integer division by truncating toward negative infinity.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @returns The integer quotient of `a / b`.\n * @throws {Error} Thrown if an unexpected negative quotient is produced.\n */\n function div(a: number, b: number) {\n const q = a / b;\n /* v8 ignore next */\n if (q < 0) {\n throw new Error(\"Unexpected negative q\");\n }\n return Math.floor(q);\n }\n\n const y = year,\n skipMarchDays = 21,\n a = mod(y, 19),\n b = div(y, 100),\n c = mod(y, 100),\n d = div(b, 4),\n e = mod(b, 4),\n f = div(b + 8, 25),\n g = div(b - f + 1, 3),\n h = mod(19 * a + b - d - g + 15, 30),\n i = div(c, 4),\n k = mod(c, 4),\n l = mod(32 + 2 * e + 2 * i - h - k, 7),\n m = div(a + 11 * h + 22 * l, 451),\n t = h + l - 7 * m + skipMarchDays,\n n = div(t, 31) + 3,\n p = mod(t, 31);\n\n return new Date(year, n - 1, p + 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Calculates the date of Father's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States and many other countries, Father's Day is observed on\n * the third Sunday of June.\n *\n * @param year - The year for which to calculate Father's Day.\n * @returns A {@link Date} representing the third Sunday in June.\n */\nexport function getFathersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 5), 0), 2);\n}\n","import { addDays } from \"date-fns\";\nimport { getEaster } from \"./getEaster\";\n\n/**\n * Calculates the date of Good Friday for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Good Friday is observed two days before Easter Sunday and commemorates the\n * crucifixion of Jesus Christ in Christian tradition.\n *\n * @param year - The year for which to calculate Good Friday.\n * @returns A {@link Date} representing Good Friday in the specified year.\n */\nexport function getGoodFriday(year: number) {\n return addDays(getEaster(year), -2);\n}\n","/**\n * Returns the date of Halloween for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Halloween is observed annually on October 31.\n *\n * @param year - The year for which to obtain Halloween.\n * @returns A {@link Date} representing October 31 of the specified year.\n */\nexport function getHalloween(year: number) {\n return new Date(year, 9, 31);\n}\n","/**\n * Returns the date of Independence Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Independence Day in the United States is observed annually on July 4.\n *\n * @param year - The year for which to obtain Independence Day.\n * @returns A {@link Date} representing July 4 of the specified year.\n */\nexport function getIndependenceDay(year: number) {\n return new Date(year, 6, 4);\n}\n","/**\n * Returns the date of Juneteenth for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Juneteenth National Independence Day is observed in the United States on June 19.\n * It became a federal holiday in 2021.\n *\n * @param year - The year for which to obtain Juneteenth.\n * @returns A {@link Date} representing June 19 of the specified year.\n */\nexport function getJuneteenth(year: number) {\n return new Date(year, 5, 19);\n}\n","import { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Labor Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Labor Day is observed on the first Monday of September.\n *\n * @param year - The year for which to calculate Labor Day.\n * @returns A {@link Date} representing Labor Day in the specified year.\n */\nexport function getLaborDay(year: number) {\n return getFirstOccurrence(new Date(year, 8), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Martin Luther King Jr. Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Martin Luther King Jr. Day is observed on the third Monday of January.\n *\n * @param year - The year for which to calculate the holiday.\n * @returns A {@link Date} representing Martin Luther King Jr. Day in the specified year.\n */\nexport function getMartinLutherKingJrDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 0), 1), 2);\n}\n","import { getLastOfMonth } from \"../utils/getters\";\n\n/**\n * Returns the date of Memorial Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Memorial Day is observed on the last Monday of May.\n *\n * @param year - The year for which to calculate Memorial Day.\n * @returns A {@link Date} representing Memorial Day in the specified year.\n */\nexport function getMemorialDay(year: number) {\n return getLastOfMonth(new Date(year, 4), 1);\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Mother's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Mother's Day is observed on the second Sunday of May.\n *\n * @param year - The year for which to calculate Mother's Day.\n * @returns A {@link Date} representing Mother's Day in the specified year.\n */\nexport function getMothersDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 4), 0), 1);\n}\n","/**\n * Returns the date of New Year's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Day is observed annually on January 1.\n *\n * @param year - The year for which to obtain New Year's Day.\n * @returns A {@link Date} representing January 1 of the specified year.\n */\nexport function getNewYearsDay(year: number) {\n return new Date(year, 0, 1);\n}\n","import { lastDayOfMonth } from \"date-fns\";\n\n/**\n * Returns the date of New Year's Eve for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * New Year's Eve is the last day of the year, observed on December 31.\n *\n * @param year - The year for which to obtain New Year's Eve.\n * @returns A {@link Date} representing December 31 of the specified year.\n */\nexport function getNewYearsEve(year: number) {\n return lastDayOfMonth(new Date(year, 11));\n}\n","import { addWeeks } from \"date-fns\";\nimport { getFirstOccurrence } from \"../utils/getters\";\n\n/**\n * Returns the date of Presidents Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * In the United States, Presidents Day is observed on the third Monday of February.\n *\n * @param year - The year for which to calculate Presidents Day.\n * @returns A {@link Date} representing Presidents Day in the specified year.\n */\nexport function getPresidentsDay(year: number) {\n return addWeeks(getFirstOccurrence(new Date(year, 1), 1), 2);\n}\n","/**\n * Returns the date of St. Patrick's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * St. Patrick's Day is observed annually on March 17.\n *\n * It is not a U.S. federal holiday, but is widely celebrated culturally,\n * particularly in the United States and Ireland.\n *\n * The returned {@link Date} is created in the local time zone.\n *\n * @param year - The year for which to obtain St. Patrick's Day.\n * @returns A {@link Date} representing March 17 of the specified year.\n */\nexport function getStPatricksDay(year: number) {\n return new Date(year, 2, 17);\n}\n","/**\n * Returns the date of Valentine's Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Valentine's Day is observed annually on February 14.\n *\n * @param year - The year for which to obtain Valentine's Day.\n * @returns A {@link Date} representing February 14 of the specified year.\n */\nexport function getValentinesDay(year: number) {\n return new Date(year, 1, 14);\n}\n","/**\n * Returns the date of Veterans Day for the specified year.\n *\n * @category Holiday\n *\n * @remarks\n * Veterans Day is observed annually on November 11 in the United States.\n *\n * @param year - The year for which to obtain Veterans Day.\n * @returns A {@link Date} representing November 11 of the specified year.\n */\nexport function getVeteransDay(year: number) {\n return new Date(year, 10, 11);\n}\n","import { getHolidays } from \"../holidays\";\nimport type { Holiday, HolidayList, Holidays } from \"../types\";\n\n/**\n * Filters the full holiday set for a given year using a predicate.\n *\n * @category Utility\n *\n * @remarks\n * This function evaluates the complete {@link Holidays} object returned by\n * {@link getHolidays} and constructs a {@link HolidayList} containing only\n * entries that satisfy the provided predicate.\n *\n * The resulting object preserves the original holiday keys but reduces each\n * entry to its date value.\n *\n * @param year - The year for which to retrieve and filter holidays.\n * @param predicate - Function applied to each holiday entry to determine inclusion.\n * @returns A {@link HolidayList} containing only matching holidays.\n */\nexport function filterHolidays(\n year: number,\n predicate: (holiday: Holidays[Holiday]) => boolean,\n): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (predicate(holiday)) {\n result[name] = {\n date: holiday.date,\n };\n }\n }\n\n return result;\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all bank holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as bank holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve bank holidays.\n * @returns A {@link HolidayList} of bank holidays occurring in the specified year.\n */\nexport function getBankHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.bankHoliday);\n}\n","import type { HolidayList } from \"../types\";\nimport { filterHolidays } from \"../utils/filters\";\n\n/**\n * Returns all federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Only holidays marked as federal holidays are included in the returned list.\n *\n * @param year - The year for which to retrieve federal holidays.\n * @returns A {@link HolidayList} of federal holidays occurring in the specified year.\n */\nexport function getFederalHolidays(year: number): HolidayList {\n return filterHolidays(year, (holiday) => holiday.federal);\n}\n","import { getBlackFriday } from \"../holiday/getBlackFriday\";\nimport { getBoxingDay } from \"../holiday/getBoxingDay\";\nimport { getChristmas } from \"../holiday/getChristmas\";\nimport { getChristmasDay } from \"../holiday/getChristmasDay\";\nimport { getChristmasEve } from \"../holiday/getChristmasEve\";\nimport { getColumbusDay } from \"../holiday/getColumbusDay\";\nimport { getEaster } from \"../holiday/getEaster\";\nimport { getFathersDay } from \"../holiday/getFathersDay\";\nimport { getGoodFriday } from \"../holiday/getGoodFriday\";\nimport { getHalloween } from \"../holiday/getHalloween\";\nimport { getIndependenceDay } from \"../holiday/getIndependenceDay\";\nimport { getJuneteenth } from \"../holiday/getJuneteenth\";\nimport { getLaborDay } from \"../holiday/getLaborDay\";\nimport { getMartinLutherKingJrDay } from \"../holiday/getMartinLutherKingJrDay\";\nimport { getMemorialDay } from \"../holiday/getMemorialDay\";\nimport { getMothersDay } from \"../holiday/getMothersDay\";\nimport { getNewYearsDay } from \"../holiday/getNewYearsDay\";\nimport { getNewYearsEve } from \"../holiday/getNewYearsEve\";\nimport { getPresidentsDay } from \"../holiday/getPresidentsDay\";\nimport { getStPatricksDay } from \"../holiday/getStPatricksDay\";\nimport { getThanksgiving } from \"../holiday/getThanksgiving\";\nimport { getValentinesDay } from \"../holiday/getValentinesDay\";\nimport { getVeteransDay } from \"../holiday/getVeteransDay\";\nimport type { Holidays } from \"../types\";\n\n/**\n * Returns the complete set of supported holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * Each holiday entry contains its calculated date together with metadata\n * indicating whether it is recognized as a federal holiday and/or a bank\n * holiday.\n *\n * Holiday observance classifications may vary by jurisdiction and may change\n * over time. The values returned by this function reflect the rules implemented\n * by this library.\n *\n * @param year - The year for which to generate holiday information.\n * @returns An object containing all supported holidays and their metadata.\n */\nexport function getHolidays(year: number): Holidays {\n return {\n blackFriday: {\n date: getBlackFriday(year),\n bankHoliday: false,\n federal: false,\n },\n boxingDay: {\n date: getBoxingDay(year),\n bankHoliday: false,\n federal: false,\n },\n /**\n * @deprecated use christmasDay instead\n */\n christmas: {\n date: getChristmas(year),\n bankHoliday: true,\n federal: true,\n },\n christmasDay: {\n date: getChristmasDay(year),\n bankHoliday: true,\n federal: true,\n },\n christmasEve: {\n date: getChristmasEve(year),\n bankHoliday: false,\n federal: false,\n },\n columbusDay: {\n date: getColumbusDay(year),\n bankHoliday: true,\n federal: true,\n },\n easter: {\n date: getEaster(year),\n bankHoliday: false,\n federal: false,\n },\n fathersDay: {\n date: getFathersDay(year),\n bankHoliday: false,\n federal: false,\n },\n goodFriday: {\n date: getGoodFriday(year),\n bankHoliday: false,\n federal: false,\n },\n halloween: {\n date: getHalloween(year),\n bankHoliday: false,\n federal: false,\n },\n independenceDay: {\n date: getIndependenceDay(year),\n bankHoliday: true,\n federal: true,\n },\n juneteenth: {\n date: getJuneteenth(year),\n bankHoliday: !(year < 2022),\n federal: true,\n },\n laborDay: {\n date: getLaborDay(year),\n bankHoliday: true,\n federal: true,\n },\n martinLutherKingJrDay: {\n date: getMartinLutherKingJrDay(year),\n bankHoliday: true,\n federal: true,\n },\n memorialDay: {\n date: getMemorialDay(year),\n bankHoliday: true,\n federal: true,\n },\n mothersDay: {\n date: getMothersDay(year),\n bankHoliday: false,\n federal: false,\n },\n newYearsDay: {\n date: getNewYearsDay(year),\n bankHoliday: true,\n federal: true,\n },\n newYearsEve: {\n date: getNewYearsEve(year),\n bankHoliday: false,\n federal: false,\n },\n presidentsDay: {\n date: getPresidentsDay(year),\n bankHoliday: true,\n federal: false,\n },\n stPatricksDay: {\n date: getStPatricksDay(year),\n bankHoliday: false,\n federal: false,\n },\n thanksgiving: {\n date: getThanksgiving(year),\n bankHoliday: true,\n federal: true,\n },\n valentinesDay: {\n date: getValentinesDay(year),\n bankHoliday: false,\n federal: false,\n },\n veteransDay: {\n date: getVeteransDay(year),\n bankHoliday: true,\n federal: true,\n },\n };\n}\n","import { addDays, isSaturday, isSunday } from \"date-fns\";\nimport type { HolidayList } from \"../types\";\nimport { getHolidays } from \"./getHolidays\";\n\n/**\n * Returns the observed federal holidays for the specified year.\n *\n * @category Holidays\n *\n * @remarks\n * This function adjusts federal holidays that fall on weekends to their\n * observed dates:\n * - Saturday holidays are observed on the preceding Friday\n * - Sunday holidays are observed on the following Monday\n *\n * Only holidays marked as `federal: true` are included in the result.\n *\n * @param year - The year for which to calculate observed holidays.\n * @returns A {@link HolidayList} containing observed federal holiday dates.\n */\nexport function getObservedHolidays(year: number): HolidayList {\n const result: HolidayList = {};\n\n for (const [name, holiday] of Object.entries(getHolidays(year))) {\n if (!holiday.federal) {\n continue;\n }\n\n if (isSaturday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, -1),\n };\n } else if (isSunday(holiday.date)) {\n result[name] = {\n date: addDays(holiday.date, 1),\n };\n }\n }\n\n return result;\n}\n","import { getYear, isSameDay } from \"date-fns\";\nimport { getBankHolidays } from \"../holidays/getBankHolidays\";\nimport { getFederalHolidays } from \"../holidays/getFederalHolidays\";\nimport { getHolidays } from \"../holidays/getHolidays\";\nimport type { HolidayList } from \"../types\";\n\n/**\n * Determines whether a given {@link Date} exists within a {@link HolidayList} for its year.\n *\n * @category Utility\n *\n * @remarks\n * The function resolves the appropriate holiday list for the year of the provided\n * {@link Date}, then checks whether any holiday in that list matches the given date\n * using calendar-day comparison (time components are ignored).\n *\n * @param date - The {@link Date} to evaluate.\n * @param getHolidayList - Function that returns a {@link HolidayList} for a given year.\n * @returns `true` if the {@link Date} matches any entry in the holiday list; otherwise `false`.\n */\nexport function isInHolidayList(\n date: Date,\n getHolidayList: (year: number) => HolidayList,\n): boolean {\n const holidays = getHolidayList(getYear(date));\n\n return Object.values(holidays).some((holiday) =>\n isSameDay(date, holiday.date),\n );\n}\n\n/**\n * Checks whether a {@link Date} is any recognized holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a holiday.\n */\nexport function isHoliday(date: Date): boolean {\n return isInHolidayList(date, getHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a federal holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a federal holiday.\n */\nexport function isFederalHoliday(date: Date): boolean {\n return isInHolidayList(date, getFederalHolidays);\n}\n\n/**\n * Checks whether a {@link Date} is a bank holiday.\n *\n * @category Utility\n *\n * @param date - The {@link Date} to evaluate.\n * @returns `true` if the {@link Date} is a bank holiday.\n */\nexport function isBankHoliday(date: Date): boolean {\n return isInHolidayList(date, getBankHolidays);\n}\n"],"mappings":"wJAoBA,SAAgB,EAAmB,EAAY,EAAwB,CACrE,OAAO,EAAkBA,EAAc,EAAM,CAAC,EAAG,CAAc,CACjE,CAeA,SAAgB,EAAkB,EAAY,EAAwB,CAUpE,OATIC,EAAa,CAAI,IAAM,IAI3B,AAGE,EAHEA,EAAa,CAAI,EAAI,EACh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M,EAAiB,CAAI,EAC3B,YAAa,GACb,QAAS,EACX,EACA,YAAa,CACX,KAAM,EAAe,CAAI,EACzB,YAAa,GACb,QAAS,EACX,CACF,CACF,CC/IA,SAAgB,EAAoB,EAA2B,CAC7D,IAAM,EAAsB,CAAC,EAE7B,IAAK,GAAM,CAAC,EAAM,KAAY,OAAO,QAAQ,EAAY,CAAI,CAAC,EACvD,EAAQ,UAIT,EAAW,EAAQ,IAAI,EACzB,EAAO,GAAQ,CACb,KAAM,EAAQ,EAAQ,KAAM,EAAE,CAChC,EACS,EAAS,EAAQ,IAAI,IAC9B,EAAO,GAAQ,CACb,KAAM,EAAQ,EAAQ,KAAM,CAAC,CAC/B,IAIJ,OAAO,CACT,CCpBA,SAAgB,EACd,EACA,EACS,CACT,IAAM,EAAW,EAAe,EAAQ,CAAI,CAAC,EAE7C,OAAO,OAAO,OAAO,CAAQ,CAAC,CAAC,KAAM,GACnC,EAAU,EAAM,EAAQ,IAAI,CAC9B,CACF,CAUA,SAAgB,EAAU,EAAqB,CAC7C,OAAO,EAAgB,EAAM,CAAW,CAC1C,CAUA,SAAgB,EAAiB,EAAqB,CACpD,OAAO,EAAgB,EAAM,CAAkB,CACjD,CAUA,SAAgB,EAAc,EAAqB,CACjD,OAAO,EAAgB,EAAM,CAAe,CAC9C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "date-fns-holidays",
3
3
  "description": "The purpose of this project is to give an interface to work with holidays using date-fns",
4
- "version": "1.2.0",
4
+ "version": "1.3.0",
5
5
  "author": "Khiet Tam Nguyen",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -21,19 +21,19 @@
21
21
  "date-fns": ">= 2.x.x"
22
22
  },
23
23
  "devDependencies": {
24
- "@biomejs/biome": "2.5.0",
25
- "@vitest/coverage-v8": "^4.1.8",
24
+ "@biomejs/biome": "2.5.2",
25
+ "@vitest/coverage-v8": "^4.1.9",
26
26
  "date-fns": "^4.4.0",
27
27
  "remark-github": "^12.0.0",
28
28
  "remark-insert-headings": "^1.0.0",
29
29
  "remark-toc": "^9.0.0",
30
30
  "shx": "^0.4.0",
31
- "tsdown": "^0.22.2",
31
+ "tsdown": "^0.22.3",
32
32
  "typedoc": "^0.28.19",
33
33
  "typedoc-plugin-markdown": "^4.12.0",
34
34
  "typedoc-plugin-remark": "^2.0.1",
35
35
  "typescript": "^6.0.3",
36
- "vitest": "^4.1.8"
36
+ "vitest": "^4.1.9"
37
37
  },
38
38
  "main": "./dist/index.cjs",
39
39
  "module": "./dist/index.mjs",