CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-temporal-polyfill

A lightweight polyfill for Temporal, successor to the JavaScript Date object

Overall
score

96%

Evaluation96%

1.19x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-7/

Legacy Date Bridge Helper

Implement a tiny module that initializes the package's bridge for legacy Date objects and uses that bridge to convert and compare moments. Use the dependency's built-in conversion from Date to its native instant type rather than recreating the transformation yourself.

Capabilities

Installs bridge once

  • Calling the initializer twice succeeds without errors and leaves conversion available on Date instances. @test

Converts Date to instant string

  • Given a UTC Date, converts it via the bridge and returns an ISO-8601 string for the same moment. @test
  • Given a Date constructed in a local offset (e.g., 2021-03-15T10:00:00-05:00), conversion yields an ISO-8601 string reflecting the exact instant (no timezone shifts beyond the original timestamp). @test

Computes gap via bridged instants

  • Given two Date inputs, computes the absolute difference in milliseconds using bridged instants instead of native Date arithmetic. @test

Implementation

@generates

API

export function installBridge(): void;
export function toInstantString(date: Date): string;
export function gapInMilliseconds(a: Date, b: Date): number;

Dependencies { .dependencies }

temporal-polyfill { .dependency }

Provides a modern time API with a built-in bridge from legacy Date objects to high-precision time values.

Install with Tessl CLI

npx tessl i tessl/npm-temporal-polyfill

tile.json