Working with dates and times is notoriously tricky: formats, time zones, durations, and edge cases add up fast. At Taskade, we have been facing these challenges for years while building scheduling and calendar features. Today, I am excited to share @taskade/temporal-parser, a new open-source library that brings a compiler approach to parsing temporal expressions in JavaScript and TypeScript.
Why temporal parsing is hard
Standards like ISO 8601 and RFC 3339 are widely used, but most libraries rely on heuristics or regexes that do not cover the full complexity of real-world strings. Things get even trickier once you include:
- time zones and offsets
- durations (e.g.,
P1Y2M3DT4H5M6S) - date/time ranges
- IXDTF annotations
- negative or historical dates
These are not edge cases. They are real parsing problems that deserve a robust solution.
What @taskade/temporal-parser brings to the table
@taskade/temporal-parser is designed from the ground up with compiler design principles: a real lexer and parser instead of ad-hoc patterns. That means:
- Standards-compliant parsing for ISO 8601, RFC 3339, and IXDTF
- Extensible architecture with an exposed lexer you can build on
- Zero dependencies + TypeScript types with a small footprint
- Dual module support for ESM and CommonJS
- Well tested with strong coverage across formats
Quick start
Install via npm:
npm install @taskade/temporal-parser
Example:
import { parseTemporal } from '@taskade/temporal-parser'
const result = parseTemporal('2025-01-12T10:00:00+08:00[Asia/Singapore]')
console.log(result)
This returns a structured AST representing the date/time, including time zone and other components. It is ideal for building robust time-aware tools and apps.
The compiler approach
Rather than hacking around with patterns, @taskade/temporal-parser treats temporal strings as formal languages: tokenized and parsed like code. The advantage is a clear AST, composability, and the ability to extend the grammar for your own use cases.
Get involved
Whether you are building scheduling UIs, event planners, calendaring utilities, or data pipelines, temporal parsing should not be a pain point.
Check it out and contribute:
Let me know what you build.