Set2.2.1+

  1. moment().set(String, Int);
  2. moment().set(Object(String, Int));

Generic setter, accepting unit as first argument, and value as second:

  1. moment().set('year', 2013);
  2. moment().set('month', 3); // April
  3. moment().set('date', 1);
  4. moment().set('hour', 13);
  5. moment().set('minute', 20);
  6. moment().set('second', 30);
  7. moment().set('millisecond', 123);
  8. moment().set({'year': 2013, 'month': 3});

Units are case insensitive, and support plural and short forms: year (years,y), month (months, M), date (dates, D), hour (hours, h), minute (minutes, m),second (seconds, s), millisecond (milliseconds, ms).

Object parsing was added in 2.9.0