momentJS date string add 5 days

前端 未结 9 1857
死守一世寂寞
死守一世寂寞 2020-12-23 09:03

i have a start date string \"20.03.2014\" and i want to add 5 days to this with moment.js but i don\'t get the new date \"25.03.2014\" in the alert window.

here my j

9条回答
  •  太阳男子
    2020-12-23 09:25

    To get an actual working example going that returns what one would expect:

    var startdate = "20.03.2014";
    var new_date = moment(startdate, "DD.MM.YYYY");
    var thing = new_date.add(5, 'days').format('DD/MM/YYYY');
    window.console.log(thing)
    

提交回复
热议问题