1 import { normalizeUnits } from '../units/aliases';
2 import { hooks } from '../utils/hooks';
3 import isFunction from '../utils/is-function';
5 export function makeGetSet (unit, keepTime) {
6 return function (value) {
8 set(this, unit, value);
9 hooks.updateOffset(this, keepTime);
12 return get(this, unit);
17 export function get (mom, unit) {
18 return mom.isValid() ?
19 mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
22 export function set (mom, unit, value) {
24 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
30 export function getSet (units, value) {
32 if (typeof units === 'object') {
34 this.set(unit, units[unit]);
37 units = normalizeUnits(units);
38 if (isFunction(this[units])) {
39 return this[units](value);