I have found an Holiday API to get the Public holidays by providing the following parameters like region, country, dates etc hope it will help you.
XML view
<l:VerticalLayout>
<l:content>
<u:Calendar
id="calendar"
months="1"
specialDates="{path: '/germalSplDts'}"
singleSelection="false" >
<u:specialDates>
<u:DateTypeRange
startDate="{parts: ['date/day', 'date/month', 'date/year'], formatter:'assets.util.mFormatter.formatCalDate'}"
type="Type09" />
</u:specialDates>
</u:Calendar>
</l:content>
</l:VerticalLayout>
Controller
setCalendarModel: function(){
var selectedDates = {
germalSplDts: [{
"date": {
"day": 1,
"month": 1,
"year": 2022,
"dayOfWeek": 6
},
"name": [{
"lang": "de",
"text": "Neujahrstag"
}, {
"lang": "en",
"text": "New Year's Day"
}],
"holidayType": "public_holiday"
}, {
"date": {
"day": 15,
"month": 4,
"year": 2022,
"dayOfWeek": 5
},
"name": [{
"lang": "de",
"text": "Karfreitag"
}, {
"lang": "en",
"text": "Good Friday"
}],
"holidayType": "public_holiday"
}, {
"date": {
"day": 18,
"month": 4,
"year": 2022,
"dayOfWeek": 1
},
"name": [{
"lang": "de",
"text": "Ostermontag"
}, {
"lang": "en",
"text": "Easter Monday"
}],
"holidayType": "public_holiday"
}, {
"date": {
"day": 1,
"month": 5,
"year": 2022,
"dayOfWeek": 7
},
"name": [{
"lang": "de",
"text": "Tag der Arbeit"
}, {
"lang": "en",
"text": "Labour Day"
}],
"holidayType": "public_holiday"
}, {
"date": {
"day": 26,
"month": 5,
"year": 2022,
"dayOfWeek": 4
},
"name": [{
"lang": "de",
"text": "Christi Himmelfahrt"
}, {
"lang": "en",
"text": "Ascension Day"
}],
"holidayType": "public_holiday"
}, {
"date": {
"day": 6,
"month": 6,
"year": 2022,
"dayOfWeek": 1
},
"name": [{
"lang": "de",
"text": "Pfingstmontag"
}, {
"lang": "en",
"text": "Whit Monday"
}],
"holidayType": "public_holiday"
}, {
"date": {
"day": 3,
"month": 10,
"year": 2022,
"dayOfWeek": 1
},
"name": [{
"lang": "de",
"text": "Tag der Deutschen Einheit"
}, {
"lang": "en",
"text": "German Unity Day"
}],
"holidayType": "public_holiday"
}, {
"date": {
"day": 25,
"month": 12,
"year": 2022,
"dayOfWeek": 7
},
"name": [{
"lang": "de",
"text": "Weihnachtstag"
}, {
"lang": "en",
"text": "Christmas Day"
}],
"holidayType": "public_holiday"
}, {
"date": {
"day": 26,
"month": 12,
"year": 2022,
"dayOfWeek": 1
},
"name": [{
"lang": "de",
"text": "Zweiter Weihnachtsfeiertag"
}, {
"lang": "en",
"text": "Boxing Day"
}],
"holidayType": "public_holiday"
}]
};
// create a Model and assign it to the View
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(selectedDates);
this.getView().setModel(oModel);
}
Note: I have hard coded the results which I got it from the below API. Kindly use the below API to get the same results using the ajax call.
For example:
https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange&fromDate=01-01-2022&toDate=30-12-2022&country=deu&holidayType=public_holiday