samedi 2 janvier 2021

Error with assignment to constant variable

I'm not a developer, I just used inspect element but my stepdad has been having a problem with his site since the new year. When using inspect element and clicking on the broken button it comes out with "TypeError: Assignment to constant variable."

The code is:

/*************************** PUBLIC VIEW ******************************/

async function displayAppointmentsFromDate(date, package, addonArray) {

    const appointments = await getAppointmentsFromDate(date);
    let html = '';
    const today = new Date();
    const thisYear = today.getFullYear();
    const thisMonth = today.getUTCMonth();
    if(thisMonth === 0) thisMonth = 12;
    const thisDay = today.getUTCDate();
    const thisDate = thisYear.toString() + '-' + thisMonth.toString() + '-' + thisDay.toString();
    const currentTime = today.toTimeString();

The error points to this line of code:

    if(thisMonth === 0) thisMonth = 12;

I can expand on the code and the website url if needed just really need help, thanks!




Aucun commentaire:

Enregistrer un commentaire