feat(timestamp): rebuild as multi-mode developer utility - #49
Merged
Merged
Conversation
✅ Deploy Preview for toolglass-by-ajithakdev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Transforms the single-converter timestamp tool into a full four-mode developer utility with a shared session history drawer. Modes: - Convert: smart single-input parser (seconds/ms/ISO/RFC) with grouped output sections — Raw Unix, Standard UTC, and Localized (timezone dropdown with pinned defaults + extensible list). - Batch: multiline textarea; regex-detects Unix timestamps and ISO 8601 strings in raw log paste; renders results as a sortable table with original, ISO, and relative columns. - Diff/Duration: two datetime inputs → live human-readable duration; reverse mode (base datetime + offset expression → resulting datetime). - Cron: expression input with live description, next-5-runs preview in selected timezone, and copy-to-clipboard per run. Other additions: - Session history sidebar (persisted to localStorage, max 10 entries) that replays any past convert/diff/cron into the relevant tab. - Code snippet flyout on each value row (JS/Python/Go/Rust snippets). - URL state sharing via useUrlState for all four modes. - ✦ symbol on Now button and Unix Timestamp label for visual identity. - useToolStats wired up: usage counter increments on every copy action.
Dropdown (Field.tsx):
- Add overflowX: hidden to listbox container — eliminates horizontal
scrollbar that appeared with long timezone names (e.g. America/Sao_Paulo).
- Wrap item label in a flex span with white-space:nowrap + text-overflow:
ellipsis so long entries truncate cleanly without reflowing the list.
- Add title={opt.label} tooltip so full name is readable on hover.
- Raise listbox z-index from 100 → 500 so it floats above the history
sidebar panel without overlap.
Toast (Toast.tsx):
- Set left: auto and maxWidth: calc(100vw - 32px) on the container so
toasts never clip or overflow on narrow viewports.
index.css:
- Add overflow-x: hidden to html/body/#root to suppress any stray
horizontal scrollbar introduced by absolutely-positioned elements.
ajithakdev
force-pushed
the
feat/timestamp-tool-overhaul
branch
from
September 6, 2026 14:44
4869605 to
52b9191
Compare
✅ Deploy Preview for toolglass-by-ajithakdev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rebuilds the Timestamp tool from a single-field converter into a four-mode developer utility, then stabilises it with a focused bug-fix and polish pass.
What changed
🛠 feat — Four-mode Timestamp tool (TimestampTool.tsx)
+1y 2mo 15d) → resulting datetime.Also included:
localStorage, max 10 entries) — replays any past convert / diff / cron back into the relevant tab on click.useUrlStatefor all four modes (shareable links).useToolStatswired up — usage counter increments on every successful copy (value rows + code snippets), consistent with ColorTool / CurlTool.🐛 fix — History runaway on Convert tab
Root cause:
parsedDate(aDateobject) was listed as auseEffectdependency. BecauseparseSmartDate()returnsnew Date()on every render, and the component re-renders every second from the live-clock ticker (setTick), React treated it as changed every tick → the historyuseEffectfired every second → a new history entry was created for every clock tick even with no user input.Fix: Removed all derived
Dateobjects from the effect dependency array. Only primitive strings (convertInput,diffDate1, etc.) remain — these change only when the user types.⚡ perf — Slow tab switching
Root cause: All four modes computed their full output on every 1-second render tick, regardless of which tab was active.
getNextCronRuns(), the batch regex loop, and threeparseSmartDatecalls for diff ran unconditionally every second.Fix: Each computation is now gated behind
activeMode === '...'. On the Convert tab, onlyparseSmartDate(convertInput)runs per tick. Cron, Batch, and Diff are no-ops until you switch to their tab.💅 fix — Dropdown, Toast, and shell polish (Field.tsx, Toast.tsx, index.css)
overflowX: hiddenon the listbox,text-overflow: ellipsis+white-space: nowrapon item labels,titletooltip for full name on hover.left: auto+maxWidth: calc(100vw - 32px)so it never clips on narrow viewports.overflow-x: hiddenonhtml/body/#rootto suppress stray horizontal scrollbar from absolutely-positioned elements.Testing checklist