Find out the previous year date from current date in javascript

后端 未结 12 1385
执念已碎
执念已碎 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:30

    var date = CALC.today(); //(function in my dev-enviro - gives today's date)
    var year = formatDate(date, 'yyyy'); //year is 2016
    year = parseInt(year);               //make sure '2016' becomes an integer
    year = year -1;                      // var year is now: 2015.
    
    //its been a while, but that's what I did from memory.
    

提交回复
热议问题