From cab49a842058b5b0ef5f098c8a91da91d33aaf70 Mon Sep 17 00:00:00 2001 From: Justin Grant Date: Thu, 18 Feb 2021 22:34:48 -0800 Subject: [PATCH] Make Duration _repr_ match toString() output Fixes #1371 --- polyfill/lib/duration.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/polyfill/lib/duration.mjs b/polyfill/lib/duration.mjs index dfd41b7160..0bb45af91c 100644 --- a/polyfill/lib/duration.mjs +++ b/polyfill/lib/duration.mjs @@ -73,8 +73,10 @@ export class Duration { SetSlot(this, NANOSECONDS, nanoseconds); if (typeof __debug__ !== 'undefined' && __debug__) { + const { precision, unit, increment } = ES.ToDurationSecondsStringPrecision({}); + const s = ES.TemporalDurationToString(this, precision, { unit, increment, roundingMode: 'trunc' }); Object.defineProperty(this, '_repr_', { - value: `${this[Symbol.toStringTag]} <${ES.TemporalDurationToString(this)}>`, + value: `${this[Symbol.toStringTag]} <${s}>`, writable: false, enumerable: false, configurable: false