fix(video): render "Today" instead of "0 seconds ago" (#1091)#1315
Merged
Conversation
Video dates have day granularity, so a video published today humanized to "0 seconds ago" — the symptom reported in #1091. video-age.js now renders "Today" for any age below one day. Add a server-side regression test pinning the contract the JS relies on (a video dated today yields an age below one day in ms); the JS guard itself has no unit test because the repo has no frontend build/test step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Addresses #1091 (already closed — this is the remaining code-level hardening).
Video dates have day granularity (server computes age from a
DateField), so a video published today humanized to "0 seconds ago" — the symptom from #1091.video-age.jsnow renders "Today" for any age below one day.The screenshot's original case (a genuinely 2-week-old video showing "0 secs ago") was already resolved by the earlier rendering rework — moving off inline
document.write()intovideo-age.js, the null-dateguard, and future-date handling (#1208). That was a stale/creation-date data issue, not a math bug. This PR just closes the last same-day edge so the literal symptom can't reappear.Changes
website/static/website/js/video-age.js—formatPastAge()returns "Today" when age< ONE_DAY_MS.website/tests/test_video.py— newtest_today_is_below_one_daypins the server-side contract the JS guard relies on (a video dated today yields an age below one day in ms). The JS guard itself has no unit test because the repo intentionally has no frontend build/test step.Testing
python manage.py test website.tests.test_video --settings=makeabilitylab.settings_test→ 4 tests pass.No screenshot: this is a string-only change with no layout impact.
🤖 Generated with Claude Code