Answers for "moment js get date only"

0

moment js year only

moment().year(Number);
moment().year(); // Number
moment().years(Number);
moment().years(); // Number
Posted by: Guest on February-23-2021
0

moment js get date 1 month

var currentDate = moment('2015-10-30');
var futureMonth = moment(currentDate).add(1, 'M');
var futureMonthEnd = moment(futureMonth).endOf('month');

if(currentDate.date() != futureMonth.date() && futureMonth.isSame(futureMonthEnd.format('YYYY-MM-DD'))) {
    futureMonth = futureMonth.add(1, 'd');
}

console.log(currentDate);
console.log(futureMonth);
Posted by: Guest on April-21-2020
0

how to create date object with specific time in moment js

var date = "2017-03-13";
var time = "18:00";

var timeAndDate = moment(date + ' ' + time);

console.log(timeAndDate);
Posted by: Guest on September-26-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language