feat: Add date picker to jump to specific dates in chat history#2
Merged
feat: Add date picker to jump to specific dates in chat history#2
Conversation
- Add clickable date separators that open a calendar modal
- Implement date picker using flatpickr library with dark theme
- Add backend API endpoint /api/chats/{chat_id}/messages/by-date
- Add database method find_message_by_date() to locate messages by date
- Implement scroll-to-date functionality with smart message loading
- Handle edge cases: no messages on date, messages not yet loaded
- Telegram-like UX: click date separator → calendar modal → jump to date
This feature allows users to quickly navigate to specific dates in their
chat history, similar to Telegram's date picker functionality.
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
…uplication - Re-raise HTTPException before generic Exception catch to return proper 404 instead of 500 - Add deduplication in loadMessages to prevent duplicate entries from jumpToDate - Capture oldest loaded message before jump to correctly trigger gap-filling load
- Change sortedMessages to sort by date instead of reverse, ensuring correct chronological order when jumpToDate adds messages out of order - Fix gap-filling logic to loop until pagination catches up to target date, rather than loading just once (which left visible gaps) - Capture oldest date before push to ensure correct comparison
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
- Capture chat ID at start of jumpToDate to detect chat switches - Abort fillGap loop if user navigates to a different chat - Update by-date API to return full message data with JOINs (user info, reactions) - Improve message merge logic to prefer complete messages from pagination
Close the modal when jumpToDate encounters a 404 or any other error, ensuring consistent UX where the modal always closes after the operation.
The date picker had a timezone mismatch: frontend displayed dates in the
viewer's timezone but backend queried using naive UTC dates. This caused
incorrect results for non-UTC timezones (e.g., a message at 23:30 UTC on
Dec 14 displays as Dec 15 in UTC+1, but querying for Dec 15 wouldn't find it).
- Add timezone parameter to /api/chats/{chat_id}/messages/by-date endpoint
- Convert user-selected date from viewer timezone to UTC before querying
- Frontend now passes viewerTimezone when calling the API
The previous termination condition checked if the oldest non-target message was newer than the target date. This caused at least one unnecessary batch to load because the check would only pass once pagination loaded messages OLDER than the target. The fix tracks message IDs before each load and stops as soon as any newly loaded message has a date at or before the target date, indicating pagination has reached the target without needing to go past it.
calvinturbo
pushed a commit
to calvinturbo/Telegram-Archive
that referenced
this pull request
Jan 26, 2026
feat: Add date picker to jump to specific dates in chat history
GeiserX
added a commit
that referenced
this pull request
Feb 3, 2026
feat: Add date picker to jump to specific dates in chat history
5 tasks
PhenixStar
pushed a commit
to PhenixStar/Telegram-Archive
that referenced
this pull request
Mar 10, 2026
feat: Add date picker to jump to specific dates in chat history
PhenixStar
pushed a commit
to PhenixStar/Telegram-Archive
that referenced
this pull request
Mar 11, 2026
feat: Add date picker to jump to specific dates in chat history
20 tasks
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
Technical Details
New API Endpoint
GET /api/chats/{chat_id}/messages/by-date?date=YYYY-MM-DD&timezone=...Frontend Changes
sortedMessagesfrom simple reverse to proper date sorting (required since jump can add messages out of order)Bug Fixes
Test Plan
Note
Adds a date picker to jump to specific dates with a new timezone-aware API to fetch the nearest message, and updates frontend sorting/merging to support out-of-order inserts.
src/web/templates/index.html.openDatePicker,closeDatePicker,jumpToDatefetch the nearest message by date (passestimezone), scroll to it, and background-fill gaps via pagination; guards against chat switches.sortedMessagesnow sorts bydate(not simple reverse). Pagination merges messages by ID, preferring richer paginated data over ad-hoc inserts.GET /api/chats/{chat_id}/messages/by-date?date=YYYY-MM-DD&timezone=...insrc/web/main.py; finds first message on/after date, falls back to nearest before or first in chat; returns message with user/media joins, parsedraw_data, and aggregatedreactions.zoneinfo.Database.find_message_by_date(chat_id, target_date)to get first message on/after a date.Written by Cursor Bugbot for commit a0aa787. This will update automatically on new commits. Configure here.