-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
  • 51,527
  • 13
  • 48
  • 61

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
  • 791
  • 1
  • 8
  • 27