Skip to content

fix(video): render "Today" instead of "0 seconds ago" (#1091)#1315

Merged
jonfroehlich merged 1 commit into
masterfrom
1091-video-today-age
Jun 17, 2026
Merged

fix(video): render "Today" instead of "0 seconds ago" (#1091)#1315
jonfroehlich merged 1 commit into
masterfrom
1091-video-today-age

Conversation

@jonfroehlich

Copy link
Copy Markdown
Member

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.js now 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() into video-age.js, the null-date guard, 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.jsformatPastAge() returns "Today" when age < ONE_DAY_MS.
  • website/tests/test_video.py — new test_today_is_below_one_day pins 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

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>
@jonfroehlich jonfroehlich merged commit ff2f5df into master Jun 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant