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