@auronet/holidays
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,4 +1,7 @@ | ||
import { PublicHoliday } from './lib/PublicHoliday.js'; | ||
export default class Holidays { | ||
private provider; | ||
constructor(country: string); | ||
getHolidays(year: number, state?: string, region?: string): PublicHoliday[]; | ||
isHoliday(date: Date, state?: string, region?: string): string; | ||
} |
@@ -0,1 +1,2 @@ | ||
import { DateTime } from 'luxon'; | ||
import { HolidayProvider } from './lib/HolidayProvider.js'; | ||
@@ -71,2 +72,13 @@ import { ATProvider, BEProvider, CHProvider, CZProvider, DEProvider, ESProvider, FRProvider, GRProvider, HRProvider, HUProvider, IEProvider, ITProvider, LTProvider, NLProvider, PLProvider, PTProvider, ROProvider, SKProvider, TRProvider, UKProvider, } from './HolidayProviders/index.js'; | ||
} | ||
getHolidays(year, state, region) { | ||
return this.provider.getHolidays(year, state, region); | ||
} | ||
isHoliday(date, state, region) { | ||
const holidays = this.provider.getHolidays(date.getFullYear(), state, region); | ||
const found = holidays.filter((h) => h.date === DateTime.fromJSDate(date).toFormat('yyyy-MM-dd')); | ||
if (found && found.length && (found[0].launchYear <= date.getFullYear() || !found[0].launchYear)) { | ||
return found[0].name; | ||
} | ||
return null; | ||
} | ||
} |
import { PublicHoliday } from './PublicHoliday.js'; | ||
export interface ProviderInterface { | ||
getAllHolidays(year: number): PublicHoliday[]; | ||
getHolidays?(year: number, state: string, region: string): PublicHoliday[]; | ||
} |
{ | ||
"name": "@auronet/holidays", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "yarn jest --detectOpenHandles", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
152366
1303