Skip to content

ZonedDateTime until / since assertion failure: mixed-sign values not allowed as duration fields #347

@phensley

Description

@phensley

Code to reproduce:

const zone = 'America/Vancouver';

// Sunday, November 2, 2025 8:01:00 AM UTC
// 2025-11-02 01:01:00-07:00 Local
const epoch1 = 1762070460000;

// Sunday, November 2, 2025 9:00:00 AM UTC
// 2025-11-02 01:00:00-08:00 Local
const epoch2 = 1762074000000;

const date1 = Temporal.Instant.fromEpochMilliseconds(epoch2).toZonedDateTimeISO(zone);
const date2 = Temporal.Instant.fromEpochMilliseconds(epoch1).toZonedDateTimeISO(zone);

// date2.until(date1) also fails
date1.until(date2, { largestUnit: 'year', smallestUnit: 'millisecond' });

Assertion failure:

RangeError: mixed-sign values not allowed as duration fields

 ❯ ES.RejectDuration ../../node_modules/.pnpm/@js-temporal+polyfill@0.5.1/node_modules/@js-temporal/polyfill/lib/ecmascript.ts:3250:50
 ❯ new Duration ../../node_modules/.pnpm/@js-temporal+polyfill@0.5.1/node_modules/@js-temporal/polyfill/lib/duration.ts:54:5
 ❯ TemporalDurationFromInternal ../../node_modules/.pnpm/@js-temporal+polyfill@0.5.1/node_modules/@js-temporal/polyfill/lib/ecmascript.ts:3400:10
 ❯ ES.DifferenceTemporalZonedDateTime ../../node_modules/.pnpm/@js-temporal+polyfill@0.5.1/node_modules/@js-temporal/polyfill/lib/ecmascript.ts:4383:14
 ❯ Temporal.ZonedDateTime.until ../../node_modules/.pnpm/@js-temporal+polyfill@0.5.1/node_modules/@js-temporal/polyfill/lib/zoneddatetime.ts:226:12

Version info:

Node.js: 22.13.1
@js-temporal/polyfill: 0.5.1
jsbi: 4.3.2
typescript: 5.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions