Skip to content

refactor: Replace 'PRC' timezone with 'Asia/Shanghai' for Debian 13+ compatibility - #58

Open
jeffwudev wants to merge 1 commit into
overtrue:masterfrom
jeffwudev:fix/timezone-asia-shanghai
Open

refactor: Replace 'PRC' timezone with 'Asia/Shanghai' for Debian 13+ compatibility#58
jeffwudev wants to merge 1 commit into
overtrue:masterfrom
jeffwudev:fix/timezone-asia-shanghai

Conversation

@jeffwudev

@jeffwudev jeffwudev commented Nov 20, 2025

Copy link
Copy Markdown

Summary

Replace the deprecated 'PRC' timezone identifier with the IANA standard 'Asia/Shanghai' timezone identifier to ensure compatibility with Debian 13 and future Linux distributions.

Changes

  • Updated the default $timezone parameter in makeDate() method from 'PRC' to 'Asia/Shanghai'

Motivation

Starting with Debian 13, the 'PRC' timezone identifier has been removed from the default timezone database (tzdata package). To continue using the 'PRC' timezone on Debian 13+, users would need to install an additional package:

sudo apt install tzdata-legacy

This creates an unnecessary dependency and potential compatibility issues for users running the library on modern Debian-based systems.

Technical Details

  • Both 'PRC' and 'Asia/Shanghai' represent the same timezone (UTC+8, China Standard Time)
  • 'Asia/Shanghai' is the IANA (Internet Assigned Numbers Authority) standard timezone identifier
  • This change maintains backward compatibility as the timezone behavior remains identical
  • 'Asia/Shanghai' is more widely supported across different platforms and will continue to be maintained in the standard tzdata package

Benefits

  • ✅ Works out-of-the-box on Debian 13+ without requiring additional packages
  • ✅ Better long-term maintainability using standardized timezone identifiers
  • ✅ No breaking changes - functionality remains the same
  • ✅ Improved cross-platform compatibility

Testing

The change has been tested and confirmed to work correctly with the existing test suite. Both timezone identifiers represent the same UTC offset and DST rules.

…ompatibility

- Update default timezone parameter in makeDate() from 'PRC' to 'Asia/Shanghai'
- The 'PRC' timezone identifier has been removed from default timezone database in Debian 13
- Using 'PRC' timezone now requires installing additional tzdata-legacy package
- 'Asia/Shanghai' is the IANA standard timezone identifier and provides better long-term compatibility
- Both timezone identifiers represent the same UTC+8 timezone but 'Asia/Shanghai' is more standardized

This change ensures the library works out-of-the-box on Debian 13+ systems without requiring additional package installations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant