How to extract night and holiday hours from your Calendar with Apps Script

It's time to update my Google Apps Script that exports calendar events into a spreadsheet. I use it to comparison my worked hours with the month payroll, so putting all my shifts on Google Calendar I have in automatic a sheet with all the shifts data. I added how to extract night and holiday hours and count the worked days in a range of dates.
This is the third article on the topic and if you want to know more I suggest you to read the previous posts: