Opened 7 years ago
Last modified 4 years ago
#29600 closed Cleanup/optimization
Remove usage of django.utils.datetime_safe where possible — at Initial Version
| 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
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() 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.