Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render current day formats in the client timezone #21878

Merged
merged 7 commits into from
Dec 15, 2022

Conversation

FrancisMurillo
Copy link
Contributor

Resolves #18966 and possibly #21716

Four instances of time formatting were incomplete (%time instead of %time.formatted):

  • Account Notes
  • Report Notes
  • Featured Tag
  • Account Strikes

Without the .formatted class, it renders the UTC time instead of local time. I added a new class relative-formatted to replace the original functionality which renders time today and date otherwise.

I think my solution is a bit dirty since i have to pass the raw translation format and format it on the client side. Perhaps just better to render just time without specifying Today at ${time}?

Also any advice for unit tests here?

app/views/disputes/strikes/show.html.haml Outdated Show resolved Hide resolved
app/views/admin/reports/show.html.haml Outdated Show resolved Hide resolved
app/views/admin/report_notes/_report_note.html.haml Outdated Show resolved Hide resolved
app/javascript/packs/public.js Outdated Show resolved Hide resolved
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine overall, I'd just use a fallback string for relative_format.today!

app/javascript/packs/public.js Outdated Show resolved Hide resolved
@ineffyble ineffyble added the ui Front-end, design label Dec 10, 2022
@Gargron Gargron merged commit c50e9d0 into mastodon:main Dec 15, 2022
neatchee pushed a commit to neatchee/mastodon that referenced this pull request Dec 16, 2022
* Fix remaining plain %time to %time.formatted

* Add %time.relative-formatted to client format dates on the current day

* Add missing comma dangle to formats

* Use client side message format instead of the server

* Add fallback message to relatve_format.today

* Remove unused translation key and fix js lint issue

Co-authored-by: Effy Elden <[email protected]>
ClearlyClaire added a commit to ClearlyClaire/mastodon that referenced this pull request Dec 20, 2022
neatchee pushed a commit to neatchee/mastodon that referenced this pull request Dec 20, 2022
* Fix remaining plain %time to %time.formatted

* Add %time.relative-formatted to client format dates on the current day

* Add missing comma dangle to formats

* Use client side message format instead of the server

* Add fallback message to relatve_format.today

* Remove unused translation key and fix js lint issue

Co-authored-by: Effy Elden <[email protected]>
neatchee pushed a commit to neatchee/mastodon that referenced this pull request Dec 21, 2022
* Fix remaining plain %time to %time.formatted

* Add %time.relative-formatted to client format dates on the current day

* Add missing comma dangle to formats

* Use client side message format instead of the server

* Add fallback message to relatve_format.today

* Remove unused translation key and fix js lint issue

Co-authored-by: Effy Elden <[email protected]>
Gargron pushed a commit that referenced this pull request Jan 5, 2023
…mp (#22555)

* Fix incorrectly formatted datetime in account moderation note timestamp

Fix oversight from #21878

* Fix use of non-existent translation string
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Jan 12, 2023
* Fix remaining plain %time to %time.formatted

* Add %time.relative-formatted to client format dates on the current day

* Add missing comma dangle to formats

* Use client side message format instead of the server

* Add fallback message to relatve_format.today

* Remove unused translation key and fix js lint issue

Co-authored-by: Effy Elden <[email protected]>
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Jan 12, 2023
…mp (mastodon#22555)

* Fix incorrectly formatted datetime in account moderation note timestamp

Fix oversight from mastodon#21878

* Fix use of non-existent translation string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui Front-end, design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audit log shows two timezones
4 participants