#29600: Remove usage of django.utils.datetime_safe where possible
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
Type: | Graham
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Tim Graham:
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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.5332b87d453a09ddfd74d86183f14d83%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.