test/dummy/vendor/assets/components/moment/src/lib/moment/from.js in date_picker-0.0.8 vs test/dummy/vendor/assets/components/moment/src/lib/moment/from.js in date_picker-0.0.9

- old
+ new

@@ -1,12 +1,16 @@ import { createDuration } from '../duration/create'; import { createLocal } from '../create/local'; +import { isMoment } from '../moment/constructor'; export function from (time, withoutSuffix) { - if (!this.isValid()) { + if (this.isValid() && + ((isMoment(time) && time.isValid()) || + createLocal(time).isValid())) { + return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); + } else { return this.localeData().invalidDate(); } - return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); } export function fromNow (withoutSuffix) { return this.from(createLocal(), withoutSuffix); }