This is actually incorrect and the range is 1-366 (January 1st is 1 and
December 31st is 365 or 366 depending on whether it's a leap year or not).
While digging there, I also noticed that the implementations of the `z`
and `W` formats seemed to just reimplement code that it already in
Python's standard library so I added some commits to the pull request to
simplify that a bit.
--
Ticket URL: <https://code.djangoproject.com/ticket/30990>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> The documentation for the `z` [date
> format](https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date)
> states that its output ranges from "0 to 365".
>
> This is actually incorrect and the range is 1-366 (January 1st is 1 and
> December 31st is 365 or 366 depending on whether it's a leap year or
> not).
>
> While digging there, I also noticed that the implementations of the `z`
> and `W` formats seemed to just reimplement code that it already in
> Python's standard library so I added some commits to the pull request to
> simplify that a bit.
New description:
The documentation for the `z`
[https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date date
format] states that its output ranges from "0 to 365".
This is actually incorrect and the range is 1-366 (January 1st is 1 and
December 31st is 365 or 366 depending on whether it's a leap year or not).
While digging there, I also noticed that the implementations of the `z`
and `W` formats seemed to just reimplement code that it already in
Python's standard library so I added some commits to the pull request to
simplify that a bit.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30990#comment:1>
Comment (by Claude Paroz):
[https://github.com/django/django/pull/12076 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/30990#comment:2>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/30990#comment:3>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/30990#comment:4>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"1185c6172b4dd5482b7bc76b12d7a0588320e027" 1185c617]:
{{{
#!CommitTicketReference repository=""
revision="1185c6172b4dd5482b7bc76b12d7a0588320e027"
Fixed #30990 -- Fixed example output in 'z' date format docs.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30990#comment:6>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"18e10740a43d3d6f70a85af6fdf3bb90bdbd1183" 18e10740]:
{{{
#!CommitTicketReference repository=""
revision="18e10740a43d3d6f70a85af6fdf3bb90bdbd1183"
Refs #30990 -- Added test for 'z' date format with a leap year.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30990#comment:5>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"1c75af9090a955339658d790fdcf9117e2989fbb" 1c75af9]:
{{{
#!CommitTicketReference repository=""
revision="1c75af9090a955339658d790fdcf9117e2989fbb"
[3.0.x] Fixed #30990 -- Fixed example output in 'z' date format docs.
Backport of 1185c6172b4dd5482b7bc76b12d7a0588320e027 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30990#comment:7>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"d5e8ad004913bc5aa9925b997154d5ef8bcb81cd" d5e8ad00]:
{{{
#!CommitTicketReference repository=""
revision="d5e8ad004913bc5aa9925b997154d5ef8bcb81cd"
[2.2.x] Fixed #30990 -- Fixed example output in 'z' date format docs.
Backport of 1185c6172b4dd5482b7bc76b12d7a0588320e027 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30990#comment:8>