Skip to content

feat: Add support for temporal api#203

Merged
hhvrc merged 5 commits into
developfrom
feat/temporal-support
May 19, 2026
Merged

feat: Add support for temporal api#203
hhvrc merged 5 commits into
developfrom
feat/temporal-support

Conversation

@hhvrc
Copy link
Copy Markdown
Contributor

@hhvrc hhvrc commented May 19, 2026

This pull request migrates the codebase from using the built-in JavaScript Date object to the modern Temporal API for all date and time handling. It introduces the temporal-polyfill dependency to ensure compatibility across environments, refactors type definitions, utility functions, and UI components to use Temporal.Instant, and updates expiration logic and formatting throughout the application. This results in more robust, accurate, and maintainable time and date management.

@hhvrc hhvrc self-assigned this May 19, 2026
Copilot AI review requested due to automatic review settings May 19, 2026 08:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the Temporal API (via temporal-polyfill) and refactors several date/time code paths to use Temporal.Instant for more consistent time handling across the app.

Changes:

  • Add temporal-polyfill and initialize it on both server (hooks.server.ts) and client (hooks.client.ts), plus global typings (app.d.ts).
  • Migrate multiple UI/code paths from Date to Temporal.Instant (terminal timestamps, hubs created_at fields, OAuth signup expiry parsing).
  • Add new Temporal utility helpers (src/lib/utils/temporal.ts) and rewire renderers/components to use them.

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/routes/terminal/types.ts Switch terminal line timestamps from Date to Temporal.Instant.
src/routes/terminal/TerminalContext.svelte.ts Generate timestamps using Temporal.Now.instant() instead of SvelteDate.
src/routes/terminal/SerialTerminal.svelte Format terminal timestamps using Temporal.Instant.
src/routes/(meta)/sitemap.xml/+server.ts Generate sitemap lastmod using Temporal.
src/routes/(app)/shares/public/dialog-publicshare-create.svelte Convert expiration selection logic to Temporal.Instant and new duration formatting.
src/routes/(app)/settings/api-tokens/dialog-token-create.svelte Convert token expiration selection logic to Temporal.Instant and new duration formatting.
src/routes/(app)/hubs/columns.ts Update hub/shocker created_at types to Temporal.Instant.
src/routes/(app)/hubs/+page.svelte Convert API-provided Date fields to Temporal.Instant for display.
src/routes/(app)/hubs/[hubId=guid]/update/+page.svelte Refactor relative-time formatting to use Temporal computations.
src/lib/utils/temporal.ts Add helper utilities for Instant conversions and duration formatting.
src/lib/utils/index.ts Export new Temporal utilities.
src/lib/signalr/handlers/Log.ts Use Temporal.Instant.from(...) for log timestamp output.
src/lib/components/Table/ColumnUtils.ts Migrate date renderers to Temporal-based formatting helpers.
src/lib/api/next/transformers/OAuthSignupData.ts Parse expiresAt into a Temporal.Instant with validation.
src/lib/api/next/models/OAuthSignupData.ts Update expiresAt type to Temporal.Instant.
src/hooks.server.ts Ensure Temporal polyfill is loaded on the server.
src/hooks.client.ts Ensure Temporal polyfill is loaded before client initialization.
src/app.d.ts Add global Temporal typings reference.
package.json Add temporal-polyfill dependency.
pnpm-lock.yaml Lockfile updates for temporal-polyfill and temporal-spec.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/routes/terminal/SerialTerminal.svelte Outdated
Comment thread src/routes/(meta)/sitemap.xml/+server.ts Outdated
Comment thread src/routes/(app)/shares/public/dialog-publicshare-create.svelte Outdated
Comment thread src/lib/utils/temporal.ts
hhvrc added 4 commits May 19, 2026 10:33
…al tests

- SerialTerminal formatTime: switch from toLocaleString (locale-dependent
  length) to toPlainTime().toString({ smallestUnit: 'second' }) for a
  guaranteed fixed-width HH:MM:SS that matches the 8-char column filler.
- sitemap: use Temporal.Now.plainDateISO('UTC') so lastmod is always the
  UTC calendar date, consistent with the previous new Date().toISOString()
  behaviour.
- dialog-publicshare-create: send null (not undefined) for expiresOn when
  no expiry is selected, preserving prior API behaviour where the backend
  may distinguish missing vs explicit null.
- Add temporal.test.ts covering durationBetween, formatDuration, and
  formatElapsed across unit boundaries, sign handling, and round-trips.
@hhvrc hhvrc merged commit 1df63f0 into develop May 19, 2026
11 checks passed
@hhvrc hhvrc deleted the feat/temporal-support branch May 19, 2026 11:25
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.

2 participants