fix: correct dashboard footer date range by sorting on tweet IDs#5
Draft
ccage-simp wants to merge 2 commits into
Draft
fix: correct dashboard footer date range by sorting on tweet IDs#5ccage-simp wants to merge 2 commits into
ccage-simp wants to merge 2 commits into
Conversation
…stead of incorrect text sorting
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.
Description
This PR fixes the date range displayed in the
ft vizdashboard footer, which was previously showing incorrect values due to how SQLite sorts raw Twitter date strings.Before:
After:
The Problem
The dashboard used
MIN(posted_at)andMAX(posted_at)to calculate the range. Because Twitter legacy dates start with the day of the week (e.g.,Fri Apr 01...vsWed Sep 30...), SQLite performs an alphabetical sort rather than a chronological one. This resulted in a bogus range (e.g.,Fri Apr 01 → Wed Sep 30) that ignored the actual years.The Fix
src/bookmarks-viz.tsto retrieve the earliest and latest bookmarks by sorting on the mathematically-sequentialtweet_id(Snowflake ID) instead of the text date strings.formatHeaderDatehelper to parse the resulting timestamps and display them cleanly asMMM YYYY(e.g.,Mar 2018 → Apr 2026) instead of raw 16-character string slices.Testing
tests/bookmarks-viz-range.test.tsto verify that chronological sorting of Snowflake IDs correctly establishes the date range even when the alphabetical order of the timestamp strings is inverted.