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

Fix post dates being inconsistent #3437

Merged
merged 5 commits into from
Oct 17, 2024

Conversation

hughrun
Copy link
Contributor

@hughrun hughrun commented Sep 14, 2024

Makes all dates fixed except if in the last day, in which case they are relative times.

Prior to this if a post was published on the same day of the month as today, the date was shown as relative (e.g. "10 months ago").

Description

What type of Pull Request is this?

  • Bug Fix
  • Enhancement
  • Plumbing / Internals / Dependencies
  • Refactor

Does this PR change settings or dependencies, or break something?

  • This PR changes or adds default settings, configuration, or .env values
  • This PR changes or adds dependencies
  • This PR introduces other breaking changes

Details of breaking or configuration changes (if any of above checked)

Documentation

  • New or amended documentation will be required if this PR is merged
  • I have created a matching pull request in the Documentation repository
  • I intend to create a matching pull request in the Documentation repository after this PR is merged

Tests

  • My changes do not need new tests
  • All tests I have added are passing
  • I have written tests but need help to make them pass
  • I have not written tests and need help to write them

Makes all dates fixed except if in the last day, in which case they are relative times.

Fixes bookwyrm-social#3365
Copy link
Contributor

@dato dato left a comment

Choose a reason for hiding this comment

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

Thanks for investigating! The fix looks good to me.

We should perhaps consider changing "M j" to "MONTH_DAY_FORMAT"?, since the former is not localized. (Not necessarily in this PR!)

(Though at the same time, the change would worsen the English localisation, since abbreviated months sound appropriate for status timestamps. MONTH_DAY_FORMAT uses full month names in English.)

@hughrun
Copy link
Contributor Author

hughrun commented Sep 18, 2024

Ah, I did think about that but wasn't sure how to do locale-specific dates. This is a good solution and admins can override the default. I'll update the PR shortly.

Copy link
Contributor

@dato dato left a comment

Choose a reason for hiding this comment

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

Great, thank you!

If you’d like, you can squash this test into your PR: hughrun#5

(I have a branch with extended tests for get_published_date, but I’m having errors mocking datetime.now(), so I’ll send them in a separate PR later.)

@mouse-reeve mouse-reeve merged commit 14dba48 into bookwyrm-social:main Oct 17, 2024
10 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.

Use consistent timestamp style
3 participants