Repository navigation
feat(guides): add Unix timestamp conversion guide - #319
varun-pahuja wants to merge 2 commits into
Conversation
anurag629
left a comment
There was a problem hiding this comment.
Thanks @varun-pahuja, this is a solid guide: the page, OG image, sitemap entry and JSON-LD all work, lint, tests and build pass, and the tables, the 2038 boundary, the 100,000,000 day range and both code samples check out. A few facts need fixing:
- The seconds vs milliseconds FAQ says a seconds value has had 10 digits "since 2001", but that only started on 2001-09-09 (1000000000), and the example right after it, 946684800 for January 1, 2000, has 9 digits (12 in milliseconds), so counting its digits gives the wrong answer. "Since September 2001" plus an example like 1700000000 and 1700000000000 fixes both.
- Millisecond values stay under the 10^11 seconds threshold until 1973-03-03, so the caveat should say "1970 to early March 1973", not "1970 to 1972".
- Step 5 and the last FAQ say the tool rejects impossible days like February 30. It does when the input starts with
YYYY-MM-DD(hasImpossibleCalendarDayinlib/time-utils.ts), so2024-02-30is an error, butFebruary 30, 2024goes straight toDate.parseand comes out as March 1. Please say it for ISO dates, something like "2024-02-30is rejected instead of rolling over". - Step 4 says every field has a copy button, but Relative time doesn't have one.
- "an instant chosen as the starting point of Unix history" isn't right: Unix work started in 1969, and the first edition counted sixtieths of a second from 1971-01-01. 1970-01-01 came later as a round reference point, so just calling it the fixed reference point is enough.
- Small one: Python prints
tzinfo=datetime.timezone.utcin that repr, nottzinfo=timezone.utc.
If this merges after today, please move publishedAt to that day too.
|
@anurag629 Thanks for the careful review. All six points addressed:
If this merges after today I'll bump All gates pass: lint 0 errors / 11 pre-existing warnings, 998 tests, build green, guide in sitemap. |
anurag629
left a comment
There was a problem hiding this comment.
Thanks @varun-pahuja, all six are fixed and read well now. One tiny thing the edit left behind: a double comma after "(10^11 ms is 1973-03-03)". Once that's gone I'll merge.
| The Timestamp Converter uses exactly these magnitude thresholds and tells | ||
| you which unit it picked, so a wrong guess is visible instead of silent. | ||
| One caveat: millisecond values from 1970 to early March 1973 are small | ||
| enough to fall under the seconds threshold (10^11 ms is 1973-03-03),, so for very old dates choose |
There was a problem hiding this comment.
| enough to fall under the seconds threshold (10^11 ms is 1973-03-03),, so for very old dates choose | |
| enough to fall under the seconds threshold (10^11 ms is 1973-03-03), so for very old dates choose |
|
Hey @varun-pahuja, just the double comma left on this one ( |
|
Hey @varun-pahuja, closing this one, since #275 went to someone else after five quiet days and the guide is now in with #397. Thanks for all the work you put into it, the fixes you made read really well. |
What and why
Adds the Unix Timestamp conversion guide the SEO coverage engine asked for in #275:
unix timestamp to datemaps to the Timestamp Converter, and the guides collection had no entry for it. NewGUIDESentry plus thepage.tsxandopengraph-image.tsxroutes, set up the same way as the existing guides.Closes #275
How I tested this
npm run lint— passes (0 errors; the 11 warnings are pre-existing)npm test— 998 passed (Node 22; the one failure seen under Node 26 is the known happy-dom/localStorage environment issue and also fails on clean develop)npm run build— passes;/guides/convert-unix-timestamp-to-dateis built, listed insitemap.xml, and its OG image route renders0,-315619200,946684800,1700000000,1792713600), the 2038 boundary2147483647, digit counts for s/ms/µs/ns, both JavaScript snippets (Node) and both Python snippets (datetimewithtimezone.utc)detectUnitinlib/time-utils.ts, the range limit matchesMAX_DATE_MS(100,000,000 days ≈ 273,791 years), and the relative-time wording matchesrelativeTimeinlib/jwt-utils.ts--limeis defined in both themes (app/guides/...usesvar(--lime)for the accent, steps, and CTA)AI assistance
Claude Code — wrote the registry entry, guide page, and test runs. I verified the examples and claims against the tool source before opening this PR.
Type of change
Checklist
npm run lint && npm run test && npm run buildpasses locallylib/and have a test inlib/__tests__/page.tsx, client component,opengraph-image.tsx, and the bug report dropdown are all doneNotes for reviewers
lib/__tests__/guides.test.tsrunsdescribe.each(GUIDES), so the new entry is picked up automatically for path, accent, metadata limits, JSON-LD, breadcrumb, and route existence — same as the other six guides.detectUnitedge case: millisecond values from 1970 to 1972 fall under the seconds threshold, so the guide tells readers to pick the unit explicitly for very old dates.MAX_DATE_MS, 100,000,000 days) rather than a rounded folklore number, and scopes the 2038 claim to 32-bittime_tand 32-bit integer epoch columns.