dateparser icon indicating copy to clipboard operation
dateparser copied to clipboard

Support short UTC offset timezones

Open CodingFeng101 opened this issue 5 months ago • 1 comments

Summary

Support two-digit UTC offset timezone strings such as +08 and -03 when they are passed through timezone settings. These values are produced by Python's timezone APIs on some systems, but currently raise UnknownTimeZoneError while equivalent forms like UTC+08, +0800, and +08:00 are accepted.

Changes

  • Normalize +HH / -HH timezone strings to the existing UTC+HH matching path.
  • Add focused regression coverage for positive and negative short UTC offsets.

Validation

  • python -m pytest tests/test_short_utc_offsets.py -q -> 2 passed
  • Manual smoke check confirmed dateparser.parse(..., settings={"TIMEZONE": "+08"}) and "-03" no longer raise.

CodingFeng101 avatar Jun 20 '26 01:06 CodingFeng101

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 97.11%. Comparing base (08c78d3) to head (03bda05).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1340   +/-   ##
=======================================
  Coverage   97.11%   97.11%           
=======================================
  Files         235      235           
  Lines        2909     2911    +2     
=======================================
+ Hits         2825     2827    +2     
  Misses         84       84           

:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 22 '26 06:06 codecov[bot]