wpenfold
5 years agoContributor
How to determine if today is between 2 dates
A task I frequently need to do is determine if today is between 2 dates (without time). I’m wondering if anyone has found a more elegant way to do this? I’ve been converting the start and end dates from an oracle database, and the current date to strings, then comparing them. It’s ugly and I feel like there should be a better way?
Date.now().toLocaleDateString() >= $GZCNTRL_START_DATE.toString().substr(0,10) && Date.now().toLocaleDateString() <= $GZCNTRL_END_DATE.toString().substr(0,10)