temporal_js
A Dart web implementation of the TC39 Temporal proposal, backed by the browser's native Temporal JS API via dart:js_interop.
This package is the web half of the temporal umbrella package. It is typically used indirectly — temporal automatically selects temporal_js on web and temporal_native on Dart VM / Flutter native.
Features
PlainDate— a calendar date (year, month, day) with no time or timezonePlainTime— a wall-clock time with no date or timezonePlainDateTime— a combined calendar date and wall-clock timePlainYearMonth— a year and month with no day or timezonePlainMonthDay— a month and day with no year or timezoneInstant— an exact UTC point in timeZonedDateTime— an exact moment tied to a specific IANA timezoneTemporalDuration— a duration spanning calendar and time unitsCalendar— a calendar system (ISO 8601, Buddhist, Hebrew, etc.)TimeZone— an IANA timezone identifier
All types are thin wrappers over the browser's native Temporal objects — zero parsing or arithmetic is reimplemented in Dart.
Getting started
Use the temporal package for cross-platform code. Add temporal_js directly only when you are building a web-only package:
dependencies:
temporal_js: ^0.0.1
Requires a browser with native Temporal support (or the temporal_js_polyfill package for older browsers).
Usage
import 'package:temporal_js/temporal_js.dart';
// Calendar date with no time ambiguity
final birthday = PlainDate(1990, 6, 15);
final nextBirthday = birthday.add(TemporalDuration(years: 34));
// Exact moment in a specific timezone
final meeting = ZonedDateTime.now(timeZone: TimeZone('America/New_York'));