Simple day manipulation with Javascript (without usingmoments
)
// Construct yesterday, today, tomorrowconsttoday=newDate();constyesterday=newDate(today);yesterday.setDate(yesterday.getDate()-1);consttomorrow=newDate(today);tomorrow.setDate(tomorrow.getDate()+1);console.log('Yesterday:',yesterday.toDateString());// => Yesterday: Tue May 26 2020console.log('Today:',today.toDateString());// => Today: Wed May 27 2020console.log('Tomorrow:',tomorrow.toDateString());// => Tomorrow: Thu May 28 2020
Top comments(0)
Subscribe
For further actions, you may consider blocking this person and/orreporting abuse