Skip to content

v0.1.0

Choose a tag to compare

@MidnightDesign MidnightDesign released this 19 Apr 13:44
· 61 commits to master since this release
f4709f6

Initial public release.

Added

  • Porcelain API (Temporal\ namespace) — PHP-native facade over the TC39 Temporal spec with strict types, readonly fields, backed enums, and named arguments:
    • PlainDate, PlainTime, PlainDateTime, PlainYearMonth, PlainMonthDay
    • Instant, ZonedDateTime
    • Duration
    • Now (factory for current-time values)
    • Enums: Calendar, Disambiguation, OffsetOption, Overflow, RoundingMode, Unit, plus display-side enums (CalendarDisplay, OffsetDisplay, TimeZoneDisplay, TransitionDirection).
  • Spec layer (Temporal\Spec\ namespace) — TC39-faithful implementation, exercised by the test262 conformance suite.
  • ECMA-402 calendar support — 16 non-ISO calendars (Hebrew, Islamic family, Japanese, Buddhist, Chinese/Dangi, Coptic, Ethiopic family, Persian, ROC, Indian) via `IntlCalendarBridge`, with pure-PHP implementations for Hebrew and Indian.
  • Factory surface per porcelain class — each class exposes a typed constructor (named arguments supported), a `parse(string)` for ISO 8601 strings, and for the five calendar-aware classes (`PlainDate`, `PlainDateTime`, `PlainYearMonth`, `PlainMonthDay`, `ZonedDateTime`) a `fromFields(...)` named-argument factory covering calendar-specific fields (`monthCode`, `era`, `eraYear`).
  • Interop — `toSpec()` / `fromSpec()` on every porcelain class for bridging to the spec layer.
  • Test262 conformance — 6615 passing test262 scripts, 0 failures (~494k assertions).

Deliberate deviations from TC39

The porcelain layer adapts TC39 semantics to PHP-native conventions rather than mirroring the JavaScript API shape 1:1.

  • No polymorphic `from()` method. Use `parse()` for strings and `fromFields()` for calendar fields. The spec layer retains TC39-faithful `from()` for callers who need exact spec semantics.
  • Named arguments, not property bags.
  • Backed enums, not option strings.

Known limitations

  • `Duration::round()` and `Duration::total()` throw `NotYetImplementedException` when balancing across calendar units that require a reference point.
  • The `Temporal\Spec\` namespace is public PSR-4 but documented as internal; a formal BC policy for the seam will land before 1.0.0.

Install: `composer require midnight/temporal-php`

Full changelog: CHANGELOG.md