JavaScript for getting the previous Monday

后端 未结 7 2095
孤城傲影
孤城傲影 2021-02-19 04:03

I would like for the previous Monday to appear in the field where a user enters today\'s date.

E.g.: If today\'s date is entered 29-Jan-16 t

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-19 04:44

    Using moment.js:

    moment().day("Monday").format('YYYY-MM-DD');
    

提交回复
热议问题