0

I want to subtract the pastDate with current date and check if the different is greater than 7 days. I am trying to do with momentjs but the subtract doesn't seems working my way.

pastDate= "2018-03-09 22:53:19";
dateFrom = moment(Date.now() - pastDate).format('YYYY-MM-DD HH:mm:ss');

if(dateFrom >= 7 ){
  console.log("Expiry Date");
}

Please help me with correct syntax.

EstevaoLuis
  • 2,422
  • 7
  • 33
  • 40
Santosh
  • 3,477
  • 5
  • 37
  • 75
  • 1
    http://momentjs.com/docs/#/displaying/difference/ – James Mar 13 '18 at 20:11
  • You are trying to do something like `1520986672165 - "2018-03-09 22:53:19"`, which is unlikely to yield a useful result, even in moment.js. – RobG Mar 14 '18 at 00:18

0 Answers0