Brought in another asset for Ray's eye form: moment
[openemr.git] / public / assets / moment-2-13-0 / src / lib / moment / to.js
blob7ad667e87f97726e81199b096731e6ff3fd4989f
1 import { createDuration } from '../duration/create';
2 import { createLocal } from '../create/local';
3 import { isMoment } from '../moment/constructor';
5 export function to (time, withoutSuffix) {
6     if (this.isValid() &&
7             ((isMoment(time) && time.isValid()) ||
8              createLocal(time).isValid())) {
9         return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
10     } else {
11         return this.localeData().invalidDate();
12     }
15 export function toNow (withoutSuffix) {
16     return this.to(createLocal(), withoutSuffix);