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

2.x Fix a bug when |time_ago didn’t consider timezones correctly #2758

Merged
merged 2 commits into from Jun 9, 2023

Conversation

gchtr
Copy link
Member

@gchtr gchtr commented May 31, 2023

Related:

Issue

The |time_ago filter doesn’t work correctly when timezone is set to Australia.

Solution

  • Don’t use strtotime(), but create DateTime objects with their corresponding timezone.
  • Update some documentation entries for correct usage with {{ post.date }}. It’s important to use a time string including the time.

Impact

The |time_ago filter should work more reliably.

Usage Changes

None.

Considerations

None.

Testing

Yes.

Update docs with new example
Copy link
Member

@Levdbas Levdbas left a comment

Choose a reason for hiding this comment

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

Nice work! I've updated the v2 doc as well

@gchtr
Copy link
Member Author

gchtr commented Jun 9, 2023

Nice work! I've updated the v2 doc as well

Thanks for that, @Levdbas! Well spotted.

@gchtr gchtr merged commit a23d781 into 2.x Jun 9, 2023
52 checks passed
@gchtr gchtr deleted the 2.x-time-ago branch June 9, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants