ts-time-utils 2.0.0 → 3.0.4
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/README.md +335 -1239
- package/dist/chain.d.ts +269 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +422 -0
- package/dist/esm/chain.d.ts +269 -0
- package/dist/esm/chain.d.ts.map +1 -0
- package/dist/esm/chain.js +422 -0
- package/dist/esm/holidays.d.ts +62 -0
- package/dist/esm/holidays.d.ts.map +1 -0
- package/dist/esm/holidays.js +793 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/plugins.d.ts +129 -0
- package/dist/esm/plugins.d.ts.map +1 -0
- package/dist/esm/plugins.js +173 -0
- package/dist/holidays.d.ts +62 -0
- package/dist/holidays.d.ts.map +1 -0
- package/dist/holidays.js +793 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/plugins.d.ts +129 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +173 -0
- package/package.json +35 -10
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview International holiday utilities
|
|
3
|
+
* Calculate holidays for multiple countries including fixed, movable, and lunar-based holidays
|
|
4
|
+
*/
|
|
5
|
+
export type CountryCode = 'UK' | 'NL' | 'DE' | 'CA' | 'AU' | 'IT' | 'ES' | 'CN' | 'IN' | 'US';
|
|
6
|
+
export interface Holiday {
|
|
7
|
+
name: string;
|
|
8
|
+
date: Date;
|
|
9
|
+
countryCode: CountryCode;
|
|
10
|
+
type: 'public' | 'bank' | 'observance';
|
|
11
|
+
}
|
|
12
|
+
export declare function getUKHolidays(year: number): Holiday[];
|
|
13
|
+
export declare function getNetherlandsHolidays(year: number): Holiday[];
|
|
14
|
+
export declare function getGermanyHolidays(year: number): Holiday[];
|
|
15
|
+
export declare function getCanadaHolidays(year: number): Holiday[];
|
|
16
|
+
export declare function getAustraliaHolidays(year: number): Holiday[];
|
|
17
|
+
export declare function getItalyHolidays(year: number): Holiday[];
|
|
18
|
+
export declare function getSpainHolidays(year: number): Holiday[];
|
|
19
|
+
export declare function getChinaHolidays(year: number): Holiday[];
|
|
20
|
+
export declare function getIndiaHolidays(year: number): Holiday[];
|
|
21
|
+
/**
|
|
22
|
+
* Get holidays for a specific country and year
|
|
23
|
+
* @param year - The year
|
|
24
|
+
* @param countryCode - ISO country code
|
|
25
|
+
* @returns Array of holidays
|
|
26
|
+
*/
|
|
27
|
+
export declare function getHolidays(year: number, countryCode: CountryCode): Holiday[];
|
|
28
|
+
/**
|
|
29
|
+
* Check if a date is a holiday in a specific country
|
|
30
|
+
* @param date - The date to check
|
|
31
|
+
* @param countryCode - ISO country code
|
|
32
|
+
* @returns True if date is a holiday
|
|
33
|
+
*/
|
|
34
|
+
export declare function isHoliday(date: Date, countryCode: CountryCode): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Get the holiday name for a specific date and country
|
|
37
|
+
* @param date - The date to check
|
|
38
|
+
* @param countryCode - ISO country code
|
|
39
|
+
* @returns Holiday name or null if not a holiday
|
|
40
|
+
*/
|
|
41
|
+
export declare function getHolidayName(date: Date, countryCode: CountryCode): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Get next holiday from a given date
|
|
44
|
+
* @param date - The reference date
|
|
45
|
+
* @param countryCode - ISO country code
|
|
46
|
+
* @returns Next holiday or null
|
|
47
|
+
*/
|
|
48
|
+
export declare function getNextHoliday(date: Date, countryCode: CountryCode): Holiday | null;
|
|
49
|
+
/**
|
|
50
|
+
* Get upcoming holidays within N days
|
|
51
|
+
* @param date - The reference date
|
|
52
|
+
* @param days - Number of days to look ahead
|
|
53
|
+
* @param countryCode - ISO country code
|
|
54
|
+
* @returns Array of upcoming holidays
|
|
55
|
+
*/
|
|
56
|
+
export declare function getUpcomingHolidays(date: Date, days: number, countryCode: CountryCode): Holiday[];
|
|
57
|
+
/**
|
|
58
|
+
* Get all supported country codes
|
|
59
|
+
* @returns Array of country codes
|
|
60
|
+
*/
|
|
61
|
+
export declare function getSupportedCountries(): CountryCode[];
|
|
62
|
+
//# sourceMappingURL=holidays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"holidays.d.ts","sourceRoot":"","sources":["../../src/holidays.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9F,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,YAAY,CAAC;CACxC;AAoED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CA+ErD;AAMD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAuG9D;AAMD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CA6E1D;AAMD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CA+EzD;AAMD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CA6E5D;AAMD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CA6FxD;AAMD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAqFxD;AAMD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CA8CxD;AAMD,wBAAgB,gBAAgB,CAAC,IAAI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