import { createLocal } from '../create/local';
import { cloneWithOffset } from '../units/offset';
+import isFunction from '../utils/is-function';
export function calendar (time, formats) {
// We want to compare the start of today, vs this.
diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse';
- var output = formats && (typeof formats[format] === 'function' ? formats[format]() : formats[format]);
+ var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]);
return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
}