Now1.0.0+

  1. moment();
  2. moment(undefined);
  3. // From 2.14.0 onward, also supported
  4. moment([]);
  5. moment({});

To get the current date and time, just call moment() with no parameters.

  1. var now = moment();

This is essentially the same as calling moment(new Date()).

Note: From version 2.14.0, moment([]) and moment({}) also returnnow. They used to default to start-of-today before 2.14.0, but that wasarbitrary so it was changed.

Note: Function parameters default to undefined when not passed in. Moment treats moment(undefined) as moment().

  1. var x = undefined;
  2. moment(x).isSame(moment(), 'second'); // true