`strftime()` is no longer used in the JSON serializer as of
9b1cb755a28f020e27d4268c214b25315d4de42e, so using `datetime_safe()` is
obsolete there.
If we remove `dateteime_safe` usage in migrations (it's need is
questionable), that would fix #29595.
--
Ticket URL: <https://code.djangoproject.com/ticket/29600>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> `django.utils.datetime_safe` was added in #1443 to overcome limitations
> in Python 2.7 where `strftime()` doesn't support dates with year < 1900.
> That issue is fixed in Python 3, but an issue remains where the result of
> `strftime('%Y')` [https://bugs.python.org/issue13305 isn't consistent]
> across all platforms. That issue was worked around in #12524.
>
> `strftime()` is no longer used in the JSON serializer as of
> 9b1cb755a28f020e27d4268c214b25315d4de42e, so using `datetime_safe()` is
> obsolete there.
>
> If we remove `dateteime_safe` usage in migrations (it's need is
> questionable), that would fix #29595.
New description:
`django.utils.datetime_safe` was added in #1443 to overcome limitations in
Python 2.7 where `strftime()` doesn't support dates with year < 1900. That
issue is fixed in Python 3, but an issue remains where the result of
`strftime('%Y')` [https://bugs.python.org/issue13305 isn't consistent]
across all platforms. That issue was worked around in #12524.
`strftime()` and `datetime_safe` are no longer used in the JSON serializer
as of 9b1cb755a28f020e27d4268c214b25315d4de42e but the fix from
03924929ba212368240bd7a26b14208fba965cb9 may still be useful in the other
places that `datetime_safe` is used.
If we remove `dateteime_safe` usage in migrations (its need there is
questionable, I think), that would fix #29595.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/29600#comment:1>
Comment (by GitHub <noreply@…>):
In [changeset:"2ac7cd52b466e5090c0479de02c4765b4c483fa3" 2ac7cd5]:
{{{
#!CommitTicketReference repository=""
revision="2ac7cd52b466e5090c0479de02c4765b4c483fa3"
Refs #29600 -- Removed datetime_safe usage in feedgenerator.
The only effect would be if items in Atom feeds had a published date
year of < 1000 (ensuring those years are padded with leading zeros).
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29600#comment:2>
Comment (by Tim Graham <timograham@…>):
In [changeset:"013d439ff038ca8e750e6d1dcd6965f33ad4cf3e" 013d439f]:
{{{
#!CommitTicketReference repository=""
revision="013d439ff038ca8e750e6d1dcd6965f33ad4cf3e"
Refs #29600 -- Added test for datetime_safe usage in localize_input().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29600#comment:4>
Comment (by Tim Graham <timograham@…>):
In [changeset:"76852c398943cf8a3b7a517f05614df3e47970c8" 76852c39]:
{{{
#!CommitTicketReference repository=""
revision="76852c398943cf8a3b7a517f05614df3e47970c8"
Refs #29600 -- Added test for datetime_safe usage in
SelectDateWidget.value_from_datadict().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29600#comment:3>
Comment (by Tim Graham <timograham@…>):
In [changeset:"c72dde41e603093ab0bb12fa24fa69cfda0d35f9" c72dde41]:
{{{
#!CommitTicketReference repository=""
revision="c72dde41e603093ab0bb12fa24fa69cfda0d35f9"
Fixed #29595 -- Allowed using timedelta in migrations questioner.
Refs #29600 -- Removed usage of django.utils.datetime_safe in migrations.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29600#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
I audited all usage of `datetime_safe` and added tests or removed usage as
appropriate.
--
Ticket URL: <https://code.djangoproject.com/ticket/29600#comment:6>
Comment (by GitHub <noreply@…>):
In [changeset:"2092206bee3281e6809a8fddb5230d80902a02b4" 2092206b]:
{{{
#!CommitTicketReference repository=""
revision="2092206bee3281e6809a8fddb5230d80902a02b4"
Refs #29600 -- Updated django.utils.datetime_safe now that Python 2 is
unsupported.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29600#comment:7>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"44accb066a51d15f27e38f203c73830eddea16df" 44accb0]:
{{{
#!CommitTicketReference repository=""
revision="44accb066a51d15f27e38f203c73830eddea16df"
Refs #32738, Refs #29600, Refs #29595 -- Removed unused
django.utils.datetime_safe.time().
Unused since c72dde41e603093ab0bb12fa24fa69cfda0d35f9.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29600#comment:8>