Moment.js - tomorrow, today and yesterday

后端 未结 12 2091
悲哀的现实
悲哀的现实 2021-01-30 00:21

I\'d like the moment().fromNow() functionality, but when the date is close it is too precise - ex. I don\'t want it to show \'in 3 hours\' but \'today\' - so basica

12条回答
  •  深忆病人
    2021-01-30 01:03

    You can also do this to get the date for today and tomorrow and yesterday

    let today     = moment();
    
    let tomorrow  = moment().add(1,'days');
    
    let yesterday = moment().add(-1, 'days');
    

提交回复
热议问题