Repository navigation
Print an older commit's date in the phone's time zone, as the web does - #164
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
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.
Beside a commit, reply, notification or Remote, the app prints how long ago it happened:
now,5m,3h,2d, and after a week the date, likeSep 1. That date was printed in the time zone devnull's answer carries, which is UTC, so away from UTC an older commit could show the day before or after the one it was made on. The web prints it in the reader's time zone.For example, with the phone in Los Angeles, a commit made at 8 PM on Aug 31 (03:00 UTC on Sep 1) shows
Sep 1in the app andAug 31on the web. A commit made on the evening of Dec 31 showsJan 1with no year, as if it were from this year.Fix
Display::relativeTime()now reads the date in the phone's time zone, throughDisplay::now(), the waydayLabel(),dayKey()andclock()already do. Both the day and the "is it this year" check use that zone. Thenow,m,handdcounts don't change.Tests
A new test in
tests/Unit/Devnull/DisplayTest.phpprints older commits with the phone inAmerica/Los_Angeles.Sep 1instead ofAug 31, andJan 1instead ofDec 31, 2025.DisplayTest.phppasses (36 passed).I didn't run this on a device.
Screenshots
Fixes #163