Skip to content

fix(parse): support Date.toString() format - #465

Merged
spencermountain merged 1 commit into
spencermountain:devfrom
xianjianlf2:fix/date-tostring-parse-148
Jul 13, 2026
Merged

fix(parse): support Date.toString() format#465
spencermountain merged 1 commit into
spencermountain:devfrom
xianjianlf2:fix/date-tostring-parse-148

Conversation

@xianjianlf2

Copy link
Copy Markdown

Problem

Strings produced by JavaScript's Date.toString(), like
"Mon Jun 17 2019 11:00:00 GMT-0700 (Pacific Daylight Time)", failed to
parse and returned an invalid spacetime.

Fix

Add an m-d-y parser that accepts a trailing GMT±HHMM (or bare ±HHMM)
offset followed by an optional (Time Zone Name) suffix. The weekday is
already stripped by normalize, so the parser matches the Month Day Year Time Offset shape and applies the offset and time.

Testing

Added test/tostring-parse.test.js covering:

  • GMT-0700 (Pacific Daylight Time)
  • GMT+0530 (India Standard Time)
  • GMT+0000 (Coordinated Universal Time)
  • bare numeric offset with no GMT prefix and no timezone name

Each asserts the result is valid and its epoch matches the equivalent ISO
string.

Closes #148

Strings produced by javascript's Date.toString(), like
"Mon Jun 17 2019 11:00:00 GMT-0700 (Pacific Daylight Time)", failed
to parse and returned an invalid spacetime. Add a m-d-y parser that
accepts a trailing "GMT±HHMM" (or bare "±HHMM") offset followed by an
optional "(Time Zone Name)" suffix.

Closes spencermountain#148
@spencermountain

Copy link
Copy Markdown
Owner

thank you!!

@spencermountain
spencermountain changed the base branch from master to dev July 13, 2026 13:03
@spencermountain
spencermountain merged commit fa85f58 into spencermountain:dev Jul 13, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support Date.toString() format

2 participants