Find out the previous year date from current date in javascript

后端 未结 12 1484
执念已碎
执念已碎 2021-02-02 07:43

I need to find out the previous year date from current date and then set as minDate in jQuery UIdatepicker in javascript

My date formaqt is dd-mm-yy

<
12条回答
  •  無奈伤痛
    2021-02-02 08:39

    For strings:

    curdate.substr(0, 6)+(curdate.substr(6)-1);
    

    If you'd use a Date object, you could easily subtract a year with the set[Full]Year method.

提交回复
热议问题