Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

Replaces Date and numeric duration types with Temporal.Instant and Temporal.Duration for type-safe temporal operations.

API Changes

  • TaskContext.sleepFor(name, duration): duration changed from number (seconds) to Temporal.Duration
  • TaskContext.sleepUntil(name, wakeAt): wakeAt changed from Date to Temporal.Instant
  • TaskContext.awaitEvent(name, options): options.timeout changed from number (seconds) to Temporal.Duration
  • CancellationPolicy: maxDuration and maxDelay changed from number (seconds) to Temporal.Duration

Implementation

  • Added temporal-polyfill dependency for universal Temporal API support
  • SQLite datetime codec handles both ISO strings and epoch milliseconds for database compatibility
  • Re-exported Temporal from package root for consumer convenience

Usage Example

import { Temporal } from "@absurd-sqlite/sdk";

// Before
await ctx.sleepFor("wait", 60);
await ctx.awaitEvent("ready", { timeout: 120 });
await spawn("task", params, { 
  cancellation: { maxDuration: 3600 } 
});

// After
await ctx.sleepFor("wait", Temporal.Duration.from({ seconds: 60 }));
await ctx.awaitEvent("ready", { 
  timeout: Temporal.Duration.from({ minutes: 2 }) 
});
await spawn("task", params, { 
  cancellation: { 
    maxDuration: Temporal.Duration.from({ hours: 1 }) 
  } 
});
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:

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@bcho bcho marked this pull request as ready for review January 19, 2026 01:51
Copilot AI and others added 3 commits January 19, 2026 01:56
Co-authored-by: bcho <1975118+bcho@users.noreply.github.com>
Co-authored-by: bcho <1975118+bcho@users.noreply.github.com>
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 Date/number duration types with Temporal Jan 19, 2026
Copilot AI requested a review from bcho January 19, 2026 02:04
@bcho bcho merged commit 1a2e7f3 into main Jan 19, 2026
8 checks passed
@bcho bcho deleted the copilot/replace-datetime-with-temporal-again branch January 19, 2026 02:11
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