fix: resolve frontend timestamp overwrite, and fix test fixtures - #59
Open
irenecancode wants to merge 2 commits into
Open
irenecancode wants to merge 2 commits into
irenecancode wants to merge 2 commits into
Conversation
oldtopos
force-pushed
the
fix/backend-timezone-fix
branch
from
August 16, 2026 16:47
e091acd to
e5bfbad
Compare
This branch has not been deployed
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
Wires up the post creation timestamp end-to-end on the feed and post detail pages, fixing two silent display bugs uncovered along the way, adding regression coverage for both, and adding a relative-time UX improvement.
Bug fixes
_normalize_post()inweb_views.pywas unconditionally overwriting the API'screatedfield withencounter_datetime(the wildlife sighting time, not the post's creation time) — in both the server-rendered templates and the infinite-scroll JSON endpoint. Removed the overwrite so the realcreatedvalue reaches the templates.|date:template filter silently renders""when given a raw string instead of adatetimeobject. Since the API client does plainresponse.json()with no datetime parsing, this had likely been invisible in the feed/detail views for a while. Fixed by parsingcreatedinto a properdatetimeviaparse_datetime()(defensively guarded so it's idempotent regardless of call order).Test coverage
FAKE_POSTtest fixture now includes acreatedvalue distinct fromencounter_datetime— previously it didn't includecreatedat all, so the existing suite could neither catch the original bug nor verify the fix.created— notencounter_datetime— is what's returned.UX enhancement
humanize.naturaltimefilter for the initial page render.formatDate()) was rewritten to matchnaturaltime's output exactly — verified boundary-for-boundary against Django's filter — so timestamps read consistently regardless of how a post entered the feed.Test plan
python manage.py test siteapps.socialmedia.test_web_views— all 39 tests passingFollow-up (separate PR)
USE_TZ/TIME_ZONEsettings betweenWildeBackyardBackendandWildeBackyardWeb(they currently share a database but disagree on timezone handling)project_restorationscaffold docstrings inWildeBackyardWeb