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

Make <time datetime= into valid HTML by using a custom jinja tag #6075

Merged
merged 1 commit into from
Sep 29, 2021

Conversation

zenmonkeykstop
Copy link
Contributor

(Resubmitting @anorthall's changes from #6058, recovered after a broken rebase)

Status

Ready for review

Description of Changes

Fixes #6057

Change the direct call to __str__() into a call to strftime() to meet the requirement of not having more than 3 decimal places for seconds on HTML. Now, no decimal places are displayed. I decided to implement this instead of the truncate filter as you cannot truncate the datetime object without first converting it to a string.

Testing

Open the website and validate the HTML.

Deployment

No special measures required.

Checklist

  • These changes do not require documentation

…dd new filter to templates (fixes #6057)

Add newline to end of template_filters.py

Remove locale argument from html_datetime_format

Remove surplus line breaks
Copy link
Contributor Author

@zenmonkeykstop zenmonkeykstop left a comment

Choose a reason for hiding this comment

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

HTML validation passes when a reply is present, LGTM! Thanks @anorthall!

Copy link
Contributor

@conorsch conorsch left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for juggling the commits @zenmonkeykstop.

@conorsch conorsch merged commit ff8c7a1 into develop Sep 29, 2021
@zenmonkeykstop zenmonkeykstop deleted the fix-6057 branch September 29, 2021 20:56
@cfm cfm mentioned this pull request Oct 8, 2021
26 tasks
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.

invalid datetime attributes
3 participants