commenthol / date-holidays

worldwide holidays
https://commenthol.github.io/date-holidays/
Other
918 stars 238 forks source link

Christmas rule not being honored for Saturday #472

Closed MichaelLiss closed 5 months ago

MichaelLiss commented 5 months ago

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"
    },
MichaelLiss commented 5 months ago

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"
    },
commenthol commented 5 months ago

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...