UNPKG

@nesto-software/moment-holiday-germany

Version:

The german locale for moment-holiday.

42 lines 2.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const moment_holiday_core_1 = require("@nesto-software/moment-holiday-core"); const moment = require("moment"); const url = require("url"); const common_state_holiday_definitions_1 = require("./common-state-holiday-definitions"); const holiday_names_1 = require("./holiday-names"); class SNStateLocale extends moment_holiday_core_1.AbstractLocale { constructor() { super(...arguments); this.legislation = new moment_holiday_core_1.Legislation("Gesetz über Sonn- und Feiertage im Freistaat Sachsen", // tslint:disable-next-line:max-line-length url.parse("https://www.revosax.sachsen.de/vorschrift/3997-SaechsSFG"), "§1 Abs. 1"); } getHolidayDefinitions() { return common_state_holiday_definitions_1.COMMON_STATE_HOLIDAY_DEFINITIONS(this.legislation).concat([ { name: holiday_names_1.HolidayName.REFORMATIONSTAG, date: new moment_holiday_core_1.RecurringDate(31, 9), tags: [ new moment_holiday_core_1.TypeTag(moment_holiday_core_1.TypeTagValue.PUBLIC), new moment_holiday_core_1.LegislationTag(this.legislation), ], }, { name: holiday_names_1.HolidayName.BUSS_UND_BETTAG, date: moment_holiday_core_1.PeriodicInYearDate.withResolver((year) => { const christmasDay = moment(new Date(year, 11, 25)); const adjustment = christmasDay.day() == 0 ? -7 : 0; // if Christmas is a Sunday, we need to go back one week further const adventSunday = christmasDay.day(-21 + adjustment); return adventSunday.subtract(11, "days"); // Buß und Bettag is 11 days before first advent sunday }), tags: [ new moment_holiday_core_1.TypeTag(moment_holiday_core_1.TypeTagValue.PUBLIC), new moment_holiday_core_1.LegislationTag(this.legislation), ], }, ]); } } exports.SNStateLocale = SNStateLocale; //# sourceMappingURL=sn.state-locale.js.map