Opened 34 minutes ago
Last modified 26 minutes ago
#37482 assigned Bug
parse_time() docs say UTC offsets give None, but they are ignored
| Reported by: | ines besrour | Owned by: | ines besrour |
|---|---|---|---|
| Component: | Uncategorized | Version: | 6.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
docs/ref/utils.txt and the docstring of django.utils.dateparse.parse_time say:
"UTC offsets aren't supported; if value describes one, the result is None."
Since #32892 (Django 4.0), parse_time() returns the time with the offset removed:
parse_time("12:34:56+05:30")
datetime.time(12, 34, 56)
This is intended: tests/utils_tests/test_dateparse.py asserts
parse_time("00:05:23+04:00") == time(0, 5, 23) ("Time zone offset is ignored").
The documentation should say the offset is ignored.
PR: https://github.com/django/django/pull/22257