Skip to content

Handle timestamps formatted as milliseconds#1312

Open
kstrauser wants to merge 1 commit intopilotmoon:masterfrom
kstrauser:master
Open

Handle timestamps formatted as milliseconds#1312
kstrauser wants to merge 1 commit intopilotmoon:masterfrom
kstrauser:master

Conversation

@kstrauser
Copy link
Copy Markdown

I stumble across a lot of timestamps formatted as milliseconds since the Unix epoch, not seconds. Concretely, instead of the current timestamp being 1765233417, they're displayed as 1765233417000.

This handles that case. If the new handleMilliseconds config option is set, then timestamps greater than the largest unsigned 32-bit integer value are not multiplied by 1000. They're passed to new Date() as-is.

A couple of notes:

  • I think this should be enabled by default. When someone looks at a timestamp in milliseconds, they're not usually expecting a datestamp in the year 70021 or so.
  • I went with 2**32-1 — 2106-02-07 — because you have to pick some threshold for when to treat a number as seconds or milliseconds, and that seemed sufficiently far out, and it can be disabled by our great great grandchildren who are bumping up against the Y2106 bug. They can ask their AI overlords to fix this for them then.

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.

1 participant