Hello i have this code js retrun erro in console
edited added full code
let now = new Date();
// we need a function that makes hours and minutes a two digit number
Object.prototype.twoDigits = function() {
return ("0" + this).slice(-2);
}
// compile the current hour and minutes in the format 09:35
timeOfDay = now.getHours().twoDigits() + ':' + now.getMinutes().twoDigits();
// test if timeOfDay is within a given time frame
if ('05:01' <= timeOfDay && timeOfDay <= '23:59') {
document.getElementById('skryj').style.display = 'none';
}
Error is:
Uncaught TypeError: V[a].exec is not a function
How to fix dont much understand JS thanks.
2
Answers
I resolve problem like this
Since it’s a date.
Other way is to use
toLocaleString
.Code;