Last active
May 28, 2017 09:46
-
-
Save chemparparokke/a7c52552f7d1cdb5d369ea890bd94d01 to your computer and use it in GitHub Desktop.
Fork of Jr. Hames (https://gist.github.com/jrhames) gist (https://gist.github.com/jrhames/5200024)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//## Moment.JS Russian Holidays Plugin | |
// | |
//Usage: | |
// Call .holiday() from any moment object. If date is a RU Federal Holiday, name of the holiday will be returned. | |
// Otherwise, return nothing. | |
// | |
// Example: | |
// `moment('08.03.2018').holiday()` will return "Международный женский день" | |
// | |
//Holidays: | |
// You can configure holiday bellow. The 'russianHolidays' is a list of federal holidays in Russia. | |
// Source used http://base.garant.ru/4029129/#block_1 | |
// | |
//License: | |
// Copyright (c) 2017 [V. Yefanov] (https://yefanov.pro/) under [MIT License](http://opensource.org/licenses/MIT) | |
(function() { | |
var moment; | |
moment = typeof require !== "undefined" && require !== null ? require("moment") : this.moment; | |
//Holiday definitions | |
var _holidays = { | |
'russianHolidays': { | |
'01.01': "Новогодние каникулы", | |
'02.01': "Новогодние каникулы", | |
'03.01': "Новогодние каникулы", | |
'04.01': "Новогодние каникулы", | |
'05.01': "Новогодние каникулы", | |
'06.01': "Новогодние каникулы", | |
'07.01': "Рождество Христово", | |
'08.01': "Новогодние каникулы", | |
'23.02': "День защитника отечества", | |
'08.03': "Международный женский день", | |
'01.05': "Праздник Весны и Труда", | |
'09.05': "День Победы", | |
'12.06': "День России", | |
'04.11': "День народного единства" | |
} | |
}; | |
moment.fn.holiday = function() { | |
return (_holidays['russianHolidays'][this.format('DD.MM')]); | |
}; | |
if ((typeof module !== "undefined" && module !== null ? module.exports : void 0) !== null) { | |
module.exports = moment; | |
} | |
}(this)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment