Skip to content

Commit

Permalink
fix(Duration): humanize should not depend on DST (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS authored Apr 24, 2024
1 parent 2da2434 commit 9784b50
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/duration/duration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2019 JS Foundation and other contributors
// Copyright 2024 YANDEX LLC

import {dateTime} from '../dateTime';
import {dateTimeUtc} from '../dateTime';
import {settings} from '../settings';
import type {Duration, DurationInput, DurationInputObject, DurationUnit} from '../typings';
import {normalizeDateComponents, normalizeDurationUnit} from '../utils';
Expand Down Expand Up @@ -288,7 +288,8 @@ export class DurationImpl implements Duration {
if (!this.isValid()) {
return 'Invalid Duration';
}
return dateTime({lang: this._locale}).add(this.valueOf(), 'ms').fromNow(!withSuffix);
const now = dateTimeUtc({lang: this._locale});
return now.add(this.valueOf(), 'ms').from(now, !withSuffix);
}

humanizeIntl(
Expand Down

0 comments on commit 9784b50

Please sign in to comment.