test/dummy/vendor/assets/components/moment/src/lib/moment/from.js in date_picker-0.0.6 vs test/dummy/vendor/assets/components/moment/src/lib/moment/from.js in date_picker-0.0.7
- old
+ new
@@ -1,8 +1,11 @@
import { createDuration } from '../duration/create';
import { createLocal } from '../create/local';
export function from (time, withoutSuffix) {
+ if (!this.isValid()) {
+ return this.localeData().invalidDate();
+ }
return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
}
export function fromNow (withoutSuffix) {
return this.from(createLocal(), withoutSuffix);