diff --git a/src/relative-time-element.ts b/src/relative-time-element.ts index 65cb6e0..620d71a 100644 --- a/src/relative-time-element.ts +++ b/src/relative-time-element.ts @@ -310,7 +310,7 @@ export class RelativeTimeElement extends HTMLElement implements Intl.DateTimeFor if (tense === 'future' && duration.sign !== 1) duration = emptyDuration if (tense === 'past' && duration.sign !== -1) duration = emptyDuration const [int, unit] = getRelativeTimeUnit(duration) - if (unit === 'second' && int < 10) { + if (unit === 'second' && Math.abs(int) < 10) { return relativeFormat.format(0, this.precision === 'millisecond' ? 'second' : this.precision) } return relativeFormat.format(int, unit) diff --git a/test/relative-time.js b/test/relative-time.js index 8b24e74..e2aef56 100644 --- a/test/relative-time.js +++ b/test/relative-time.js @@ -1701,13 +1701,13 @@ suite('relative-time', function () { datetime: '2022-10-24T14:45:10.000Z', tense: 'past', format: 'relative', - expected: 'now', + expected: '50 seconds ago', }, { datetime: '2022-10-24T14:45:10.000Z', format: 'relative', formatStyle: 'narrow', - expected: 'now', + expected: '50s ago', }, { datetime: '2022-10-24T14:45:10.000Z',