commenthol / date-holidays

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

Technically every sunday is a holiday in `DE-HE` #14

Open leipert opened 7 years ago

leipert commented 7 years ago

This is not fixed in #12:

Technically every sunday is a holiday in DE-HE.

Public holidays are the sundays and [...] Source: http://www.datumsrechner.de/gesetze/Hessen.pdf

I do not know how you want to handle this.

commenthol commented 7 years ago

Sorry, there is no rule for that yet. I don't know if this is really of relevance in this lib as it would "pollute" the real information a user would like to see. Legally seen the it would be correct to show each Sunday in the list. I am undecided in this case.

Maybach91 commented 7 years ago

I agree with @commenthol that it would be a kind of pollution. But i need the option to declare the sundays as holiday too. Or just to check if the selected date is a sunday. Is there any option for this?

edit i've hacked it with the following

var calendarConfig = {
  onChange: [
        // Check Holiday and alert the extra charge information
        function(selectedDates, dateStr, instance){
            if(hd.isHoliday(new Date(dateStr)) || selectedDates.toString().indexOf("Sun") === 0 ){
                ....
         }
}

works for me with the single date selection. didnt tested it with range/multi dateselect

commenthol commented 7 years ago

@Maybach91 No there is no such option. As you are checking date by date I would recommend to use the new Date(dateStr).getDay() === 0 comparison instead of checking the localized string.