Opened 6 years ago

Last modified 3 years ago

#29600 closed Cleanup/optimization

Remove usage of django.utils.datetime_safe where possible — at Version 1

Reported by: Tim Graham Owned by: Tim Graham
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

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') 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.

Change History (1)

comment:1 by Tim Graham, 6 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top