MomentJS - Moment Clone



Moment Clone will create a copy of the moment created.

Syntax

moment(Moment);

There are 2 ways to clone a moment. Observe the following examples for a better understanding −

Example 1

var date1 = moment([2017,06,10]);
var date2 = moment(date1);

Output

Moment Clone

Example 2

var date1 = moment([2017,06,10]);
var date2 = date1.clone();

Output

Date Clone
momentjs_parsing_date_and_time.htm
Advertisements