I make use of a own employee schedule system and it works great for 3 years. Now this year a new bug appears :). We work with week days and the systeem calculates current date + 7 days to calculate the next week. If you check on a sunday in december (e.g. 25-12-2022 is a sunday + 7 days) the schedule for week 52 you will find an error because 01-01-2023 is a sunday but the system says it is week 52 (so the schedule goes to week 52 of 2023 instead of week 52 of 2022).
    $('#nweek_availability').click(function(){
        setTimeout(function() {
            var week = $('.week-picker').val();
            var longs = Number(week.substr(1,2)) + 1;
            selectedDate = moment(new Date(year, month, day)).add(7, 'days').format('DD-MM-YYYY');
            if ((longs < 53) && (longs > 0)) {
                $('.nortifi-pick-week').attr('hidden', true)
                location.replace("./schedule.php?page=employee-availability&week=" + longs + "&date=" + selectedDate);
            }
            else{
                $('.nortifi-pick-week').attr('hidden', false)
            }
        }, 500);
    });
Maybe it is easier to calculate the first monday of the new week instead of current day + 7.
Did not find a solution yet to solve this but made some buttons with date that starts on monday for the next 6 weeks, so we can use buttons instead of next week arrow button so the problem doesn't show.