Why is this returning false instead of true? - Arbitrary JS

Hi, i’m trying to run this code which used to work well on the arbitrary JS component by Pragmaflow, but it returns false instead of true even though it’s 11am. any idea what could be wrong with it?

thank you

var currentTime = new Date();
var dayOfWeek = currentTime.getDay();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();

var isOpen = dayOfWeek >= 1 && dayOfWeek <= 7 && hours >= 7 && (hours < 17 || (hours === 17 && minutes <= 30));

return isOpen ? true : false;

Try new Date().toLocalDateString(), or toLocalUTCString(), js has these functions to unify times

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.