commenthol/date-holidays

Christmas rule not being honored for Saturday

Closed this issue · 2 comments

I ran this;

var Holidays = require('date-holidays');
hd = new Holidays('US');
hd.setTimezone("America/Denver");

...
  let ret = hd.getHolidays( 2027 );

got this:

    {
        "date": "2027-12-25 00:00:00",
        "start": "2027-12-25T07:00:00.000Z",
        "end": "2027-12-26T07:00:00.000Z",
        "name": "Christmas Day",
        "type": "public",
        "rule": "12-25 and if sunday then next monday if saturday then previous friday"
    },

I was expecting 24 December based on
"rule": "12-25 and if sunday then next monday if saturday then previous friday"

NOTE: Sunday ( for 2033 ) seems to work:

    {
        "date": "2033-12-26 00:00:00",
        "start": "2033-12-26T07:00:00.000Z",
        "end": "2033-12-27T07:00:00.000Z",
        "name": "Christmas Day (substitute day)",
        "type": "public",
        "substitute": true,
        "rule": "12-25 and if sunday then next monday if saturday then previous friday"
    },

whoop... it IS there:

    {
        "date": "2027-12-24 00:00:00",
        "start": "2027-12-24T07:00:00.000Z",
        "end": "2027-12-25T07:00:00.000Z",
        "name": "Christmas Day (substitute day)",
        "type": "public",
        "substitute": true,
        "rule": "12-25 and if sunday then next monday if saturday then previous friday"
    },

Yes, this has to do with the "12-25 and ..." rule. It is assumed that people will still celebrate on 25th apart from getting an additional day off given by the legislation.
Hope its fine if I am closing this issue...