//! moment-holiday.js locale configuration //! locale : pascha Related Holidays //! author : Kodie Grantham : https://github.com/kodie //(function() { // var moment = (typeof require !== 'undefined' && require !== null) && !require.amd ? require('moment') : this.moment; function init(moment) { // moment.holidays.pascha = { moment.modifyHolidays.add({ "Lent": { date: 'pascha-46|pascha-3' }, /* "Holy Monday": { date: 'pascha-6', keywords_y: ['great', 'monday'] }, "Holy Tuesday": { date: 'pascha-5', keywords_y: ['great', 'tuesday'] }, "Holy Wednesday": { date: 'pascha-4', keywords_y: ['great', 'wednesday'] }, "Holy Thursday": { date: 'pascha-3', keywords_y: ['great', 'thursday'] }, "Holy Friday": { date: 'pascha-2', keywords_y: ['great', 'friday'] }, "Holy Saturday": { date: 'pascha-1', keywords_y: ['holy', 'saturday'] }, */ "Pascha Sunday": { date: 'pascha', keywords_y: ['pascha'], keywords: ['sunday'] }, "Bright Week": { date: 'pascha+1|pascha+6' }, "Pentecost Sunday": { date: 'pascha+49', keywords_y: ['pentecost'], keywords: ['sunday'] }, //}; }); const orthodoxDates = require("./pascha-dates.js"); var pascha = function(year) { /* Date lookup table.. */ var date = orthodoxDates[year].split("-"); date[1] -= 1; /* month needs to be zero index */ return moment(date); } moment.modifyHolidays.extendParser(function(m, date){ if (~date.indexOf('pascha')) { var dates = date.split('|'); var ds = []; for (var i = 0; i < dates.length; i++) { if (dates[i].substring(0, 6) === 'pascha') { var e = pascha(m.year()); if (dates[i].charAt(6) === '-') { e.subtract(dates[i].substring(7), 'days'); } if (dates[i].charAt(6) === '+') { e.add(dates[i].substring(7), 'days'); } if (dates.length === 1) { return e; } ds.push(e.format('M/D')); } else { ds.push(dates[i]); } } if (ds.length) { return ds.join('|'); } } }); console.log("Pascha initialized"); } module.exports = init; // if ((typeof module !== 'undefined' && module !== null ? module.exports : void 0) != null) { module.exports = moment; } //}).call(this);