0

I have 7 buttons with text current Week's Dates, Month, Day. On Click of something need changes the Dates, Month, Days to next Week of the month/next month.


    $("#nextweek").click(function () {
        debugger;
        var lastDayinWeek = $("#ts_timeentry").val();
        var lastDayinWeekInDateFormat = new Date(lastDayinWeek);
        var dd = lastDayinWeekInDateFormat.getDate()+7;
        var mm = lastDayinWeekInDateFormat.getMonth();
        var yyyy = lastDayinWeekInDateFormat.getFullYear();
        if (dd < 10) dd = '0' + dd;
        if (mm < 10) mm = '0' + mm;
        lastDayinWeekInDateFormat = mm + '/' + dd + '/' + yyyy;
        $("#ts_timeentry").val(lastDayinWeekInDateFormat);

    });

I tried adding days, but getting invalid Date after end of the month

0 Answers0