Skip to content

ABI: implement private Date parsing and ISO formatting #187

Description

@chrisbbreuer

Parents: #163, #164
Depends on: #179, #180

Implement the shared private Date parsing, UTC extraction, and ISO buffer boundary.

Acceptance:

  • Export JSC__JSValue__dateInstanceFromNullTerminatedString, JSC__JSValue__getUTCTimestamp, JSC__JSValue__toISOString, and JSC__JSValue__DateNowISOString.
  • Parse the complete NUL-terminated byte string using the engine Date parser, create a fresh selected-realm Date cell, and preserve invalid parses as a Date with a NaN internal value.
  • Return the Date internal UTC epoch-millisecond value from getUTCTimestamp; return NaN for non-Date, invalid, or foreign-VM values.
  • Write exact ECMAScript UTC ISO output (24-byte ordinary years, 27-byte extended years) without a terminator and return the byte count; return -1 without modifying the caller buffer for non-Date/non-finite input.
  • Make DateNowISOString use the realm clock and the same 28-byte writer contract.
  • Document the pinned-source defect: Bun's Zig declaration for DateNowISOString is (*JSGlobalObject, f64) JSValue, but its wrapper and C++ implementation use (*JSGlobalObject, *[28]u8) c_int; implement and test the executable wrapper/C++ contract.
  • Document that the pinned Bun source declares but does not define getUTCTimestamp; test the coherent UTC internal-time contract rather than claiming a matched C++ body.
  • Cover epoch, fractional truncation, pre-epoch milliseconds, leap dates, offsets, extended years, invalid input, non-Date values, same-VM sibling realms, foreign VMs, and failure-atomic buffers.
  • Refresh Home/Bun inventories and README/API documentation without changing public/extension counts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions