Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

Replace JavaScript Date with the Temporal API for datetime types, using temporal-polyfill as referenced in the issue.

Changes

  • New temporal-types.ts module exporting:

    • Temporal.Instant for exact points in time
    • Temporal.Duration for time spans
    • Conversion helpers: instantFromDate, instantToDate, durationFromSeconds, durationToSeconds
    • Type guards: isInstant, isDuration
  • sqlite.ts: datetime columns now decode to Temporal.Instant instead of Date

  • sqlite-types.ts: SQLiteBindValue now accepts Temporal.Instant

Breaking Change

// Before
const run = await ctx.getRun(runID);
const epochMs = run.available_at.getTime();

// After  
const run = await ctx.getRun(runID);
const epochMs = run.available_at.epochMilliseconds;

// Or convert back to Date if needed
import { instantToDate } from "@absurd-sqlite/sdk";
const date = instantToDate(run.available_at);

Tests

Added 16 tests for Temporal type conversions and guards.

Original prompt

This section details on the original issue you should resolve

<issue_title>sdks/typescript: replace datetime / untyped duration types with Temporal</issue_title>
<issue_description>Refs:

<agent_instructions>Please start with identifying usages first, then go minimal design & implementation; provide tests for the changes.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 14, 2026 07:25
Co-authored-by: bcho <1975118+bcho@users.noreply.github.com>
Co-authored-by: bcho <1975118+bcho@users.noreply.github.com>
…tring()

Co-authored-by: bcho <1975118+bcho@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace datetime and untyped duration types with Temporal sdks/typescript: replace datetime / untyped duration types with Temporal Jan 14, 2026
Copilot AI requested a review from bcho January 14, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sdks/typescript: replace datetime / untyped duration types with Temporal

2 participants