Set2.2.1+
moment().set(String, Int);
moment().set(Object(String, Int));
Generic setter, accepting unit as first argument, and value as second:
moment().set('year', 2013);
moment().set('month', 3); // April
moment().set('date', 1);
moment().set('hour', 13);
moment().set('minute', 20);
moment().set('second', 30);
moment().set('millisecond', 123);
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
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .