Repository navigation
feat(blocks): show the date on entries from earlier days - #352
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Self-review summary: 2 rounds on this branch before handoff. Accepted:
Declined:
Deferred (not blocking)
|
Contributor
|
Hey @thomasguillot, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
Collaborator
|
@thomasguillot Thank you! This looks good. |
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.
Most built-in layouts show only the time of each entry. On a liveblog that runs across days, the feed can go from 12:49 pm straight to 5:27 pm with nothing to say the second entry is from the day before. This adds the date to entries from earlier days, using the same rule Clock got in #338.
What changes
Layouts that show the time now add the date in the site's date format for entries from an earlier day. Today's entries look exactly as before. Pages check again in the browser, so a cached page or one left open past midnight shows the date on yesterday's entries without a reload.
With this change:
Closes #351.
How to test
Technical details
earlierDayDate()intemplate.tsbuilds the Post Date withEARLIER_DAY_DATE_CLASSand the{{date_format}}token, which Clock now uses too (its server copy is unchanged). The server filtermark_earlier_day_entry_date()and the view'srefreshEarlierDayDates()from feat: add ready-made liveblog page patterns #338 handle hiding and the midnight re-check, so there is no new server code.newspack-rolling-coverage-byline-timerow, Margin and Wire throughtimeRow(), Rail and Split under the time (Split wraps the New label and time in a stack so the phonerow-reverserule still applies).display: block; visibility: hidden), and the time hasflex-shrink: 0; white-space: nowrap, so on the narrowest phones only an earlier-day date breaks after its comma. The layout test now requires a New label that shares a line to sit in a row that never wraps..newspack-rolling-coverage-earlier-day-date[hidden] { display: none; }, so a theme settingdisplayon post dates can't show today's date.test-earlier-day-date.phprenders all seven layouts with today's date hidden and an earlier day's shown.Self-review: two rounds (Opus 5.5), one blocker fixed.