Releases: taskade/temporal-parser
v1.2.1
Patch Changes
-
3f20258: Add support for ISO 8601 basic format and bare hours in
parseTimeString()New formats supported:
- ISO 8601 basic format (compact, no colons):
"1430"→ 14:30"143045"→ 14:30:45"143045.123"→ 14:30:45.123
- Bare hours (defaults to :00 minutes):
"7"→ 7:00"7 AM"→ 7:00 AM"23"→ 23:00
The parser intelligently detects the format based on digit count and presence of colons, maintaining full backward compatibility with existing formats.
- ISO 8601 basic format (compact, no colons):
v1.2.0
Minor Changes
- e2b6e24: Add
parseTimeStringfunction for parsing standalone time strings in multiple formats (12h/24h, AM/PM, locale variations). ReturnsTimeAstcompatible with Temporal.PlainTime. Handles common LLM-generated time formats like "09:00" alongside locale formats like "9:07 AM". Features LLM-friendly error messages with examples and suggestions.
v1.1.0
Minor Changes
-
c557ac0: feat: Add support for BC dates (negative years in ISO 8601)
Implement parsing and stringification of BC dates using ISO 8601 extended year format with negative year numbers. This follows the astronomical year numbering system where year 0 = 1 BC, year -1 = 2 BC, etc.
Key features:
- Parse BC dates with negative year notation:
-0044-03-15(44 BC) - Support year 0 representing 1 BC:
0000-01-01 - Handle BC dates with time and timezone components
- Proper year padding in output:
-0044,-0001 - Full round-trip compatibility
Supported formats:
- BC year only:
-0100 - BC year-month:
-0753-04 - BC full date:
-0044-03-15 - BC datetime:
-0044-03-15T12:00:00 - BC with timezone:
-0044-03-15T12:00:00Z
Examples:
// Parse the Ides of March, 44 BC const bcDate = parseTemporal("-0044-03-15"); // { kind: 'DateTime', date: { year: -44, month: 3, day: 15 }, ... } // Stringify BC date stringifyDate({ kind: "Date", year: -44, month: 3, day: 15 }); // Returns: '-0044-03-15' // Year 0 represents 1 BC in ISO 8601 parseTemporal("0000-01-01"); // { kind: 'DateTime', date: { year: 0, month: 1, day: 1 }, ... }
This implementation maintains full backward compatibility and follows ISO 8601:2004 extended year format specification.
- Parse BC dates with negative year notation:
-
7223124: feat: add comprehensive stringify API for AST serialization
Add comprehensive stringify API for AST serialization. Implements full round-trip serialization support by converting parsed temporal ASTs back to ISO 8601/IXDTF formatted strings.
New exports:
stringifyTemporal()- Main function for all temporal typesstringifyDate(),stringifyTime(),stringifyDateTime()- DateTime componentsstringifyDuration(),stringifyRange()- Duration and Range typesstringifyOffset(),stringifyTimeZone(),stringifyAnnotation()- Supporting components
Features:
- Automatic normalization of offsets to canonical format (±HH:MM)
- Component-based reconstruction for consistent output
- Full round-trip compatibility with parser
- Preserves all AST information including annotations and critical flags
Example:
import { parseTemporal, stringifyTemporal } from "@taskade/temporal-parser"; const ast = parseTemporal("2025-01-12T10:00:00+0530"); // Compact format const normalized = stringifyTemporal(ast); // '2025-01-12T10:00:00+05:30' (canonical format)
Patch Changes
-
692b0f7: fix: Support comma as decimal separator in fractional seconds (European format)
Add support for comma (
,) as a decimal separator in fractional seconds for both time and duration components, as specified in ISO 8601. This enables parsing of European-formatted temporal strings while maintaining canonical dot (.) notation in serialized output.Supported formats:
- Time with fractional seconds:
T10:30:45,123→T10:30:45.123 - Duration with fractional seconds:
PT1,5S→PT1.5S
Behavior:
- Parser accepts both
.and,as decimal separators - Stringify normalizes all output to use
.for consistency - Full round-trip compatibility maintained
This change improves ISO 8601 compliance and enables parsing of temporal strings from European locales where comma is the standard decimal separator.
- Time with fractional seconds:
v1.0.5
v1.0.4
v1.0.2
v1.0.1
Patch Changes
- 7e2bb77: docs: add CHANGELOG.md with 1.0.0 release notes
- 5165f82: build(ci): Fix GitHub Packages publish workflow to use correct registry. Previously, the GitHub Packages publish step was attempting to publish to npm registry instead of GitHub Packages registry. This adds the explicit
--registryflag to ensure packages are published to the correct location.