Skip to content

Conversation

Copy link

Copilot AI commented Jan 16, 2026

ISO-8601 Clause 5.4 defines standalone time representations without date components (10:30, 10:30:45, 10:30:45.123). Parser currently requires a date component, rejecting valid time-only inputs.

Changes

Type system (parser-types.ts)

  • Added TimeAst to ValueAst union alongside DateTimeAst and DurationAst

Parser (parser.ts)

  • Detect standalone time via lookahead: Number followed by Colon
  • Route to existing parseTime() before attempting date parse

Stringify (stringify.ts)

  • Handle TimeAst in stringifyTemporal() and stringifyRange()

Usage

// Standalone time parsing
parseTemporal('10:30')           // { kind: 'Time', hour: 10, minute: 30 }
parseTemporal('10:30:45.123')    // { kind: 'Time', ..., fraction: '123' }
parseTemporal('10:30:45,123')    // European format, normalized to dot

// Time ranges
parseTemporal('10:00/12:00')     // { kind: 'Range', start: {...}, end: {...} }

// Round-trip
stringifyTemporal(parseTemporal('10:30:45'))  // '10:30:45'

Backward compatible—existing datetime, duration, and range parsing unchanged.

Original prompt

This section details on the original issue you should resolve

<issue_title>bug: Support time only ISO-8601 format</issue_title>
<issue_description>particularly

  • A time of day may be represented alone, without any date component.

Clause 5.4 defines formats such as:

  • hh:mm:ss
  • hh:mm:ss.sss
  • Reduced precision forms like hh:mm

These are all valid standalone time representations.

Represent as a standalone TimeAst</issue_description>

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.

@changeset-bot
Copy link

changeset-bot bot commented Jan 16, 2026

⚠️ No Changeset found

Latest commit: 94c586c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI and others added 2 commits January 16, 2026 06:05
Co-authored-by: lxcid <297156+lxcid@users.noreply.github.com>
Co-authored-by: lxcid <297156+lxcid@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for time only ISO-8601 format Add standalone time-only ISO-8601 format support (Clause 5.4) Jan 16, 2026
Copilot AI requested a review from lxcid January 16, 2026 06:15
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.

bug: Support time only ISO-8601 format

2 participants