There is a date 2018-11-12 how to take 1 day from it in js? urrDate.setDate(CurrDate.getDate() - 1); it does not work, writes:
Uncaught TypeError: sdate.getDate is not a function There is a date 2018-11-12 how to take 1 day from it in js? urrDate.setDate(CurrDate.getDate() - 1); it does not work, writes:
Uncaught TypeError: sdate.getDate is not a function The easiest way is through the moment library.
And if without a library, get the timestamp first and subtract the day in milliseconds from it:
const dayMilliseconds = 24*60*60*1000; var currentDate = new Date(); currentDate.setTime(currentDate.getTime() - dayMilliseconds); sdate is a string, not a date. - IgorSource: https://ru.stackoverflow.com/questions/919731/
All Articles