Opened 6 years ago
Last modified 6 years ago
#31006 closed Cleanup/optimization
Document how to escape a date/time format character for the |date and |time filters. — at Version 4
| Reported by: | Baptiste Mispelon | Owned by: | Ryan Cheley |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
The current documentation for the date and time filters doesn't explain how to escape a format character.
It's only documented as part of the now template tag:
Note that you can backslash-escape a format string if you want to use the “raw” value. In this example, both “o” and “f” are backslash-escaped, because otherwise each is a format string that displays the year and the time, respectively:
It is the {% now "jS \o\f F" %}
This would display as “It is the 4th of September”.
Historically, the big table with all the available format characters used to be next to the documentation for {% now %} but it was moved at some point (to be with the documentation for |date.
I would suggest moving the paragraph about backslash escape under the table of all formats instead (or least duplicating it there too).
Change History (4)
comment:1 by , 6 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 6 years ago
| Summary: | Document how to escape a date/time format character for the |date and |time filters → Document how to escape a date/time format character for the |date and |time filters. |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:4 by , 6 years ago
| Description: | modified (diff) |
|---|---|
| Has patch: | set |
datedocumentation contains an example with escaped format characters:so maybe we can add a short explanation to this example, e.g.:
I also agree to duplicate backslash example to the
timedocumentation.