In JS, how can I get the date to format to MM/DD/YYYY?
new Date(Date.now() + (8 * 86400000)).toLocaleString().split(',')[0])
returns "12/1/2020"
How can I format it to "12/01/2020"?
fromDate:
(new Date(Date.now() + (1 * 86400000)).toLocaleString().split(',')[0]),
toDate:
(newDate(Date.now() + (8 * 86400000)).toLocaleString().split(',')[0])
I would like the fromDate and toDate to be:
If between 5:00 PM MST and Midnight: set fromDate
to tomorrow's
date , and toDate
to tomorrow's date + 7 days
How can compare the currentTime to say if it is greater than 5 PM local time?
let currentTime = new Date().toLocaleTimeString('en-US', {
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false
});