-3
const dayOfWeek = moment().tz(timezone).format('d');

//test for weekend // 0 = sunday, 6=saturday

if ((dayOfWeek === 0 ) || (dayOfWeek == 6)
    {
        response = "closed";
    }
        else
    {
        response = "open";
    }

this part {dayOfWeek === 0) failed to test TRUE, really not sure why

Thank you for your help.

ADyson
  • 57,178
  • 14
  • 51
  • 63

1 Answers1

0

Double check if dayOfWeek is 0 (number) or '0' (string). I see that for the next check you use == and not ===. Have a look at strict equality

Cezar Cobuz
  • 1,077
  • 1
  • 12
  • 34