I'm trying to switch text depending on dates.
document.getElementById('test').innerHTML = today.toISOString().substring(0, 10) == '2021-12-05' ? 'A' : 'B';
Try this: You need to call new Date() to load the current datetime
document.getElementById('test').innerHTML = new Date() > new Date('2021-12-05') ? 'A' : 'B';
<div id="test"></div>