mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-02-07 03:23:29 -05:00
Use a named local timezone for better display of historical dates in the local timezone
See #2133435 (Suggestion for timezone handling (linux example included))
This commit is contained in:
parent
e1e4aa46aa
commit
59cee5b4df
@ -54,6 +54,8 @@ dependencies = [
|
||||
"PyQt6_WebEngine == 6.8.0",
|
||||
"MacFSEvents == 0.8.4; sys_platform == 'darwin'",
|
||||
"xxhash == 3.3.0",
|
||||
"tzdata == 2025.2",
|
||||
"tzlocal == 5.3.1",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
||||
@ -3,11 +3,18 @@
|
||||
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import tzlocal
|
||||
|
||||
from calibre_extensions import speedup
|
||||
|
||||
utc_tz = timezone.utc
|
||||
local_tz = datetime.now().astimezone().tzinfo
|
||||
try:
|
||||
tz_name = tzlocal.get_localzone_name()
|
||||
local_tz = ZoneInfo(tz_name)
|
||||
except Exception:
|
||||
local_tz = datetime.now().astimezone().tzinfo
|
||||
UNDEFINED_DATE = datetime(101,1,1, tzinfo=utc_tz)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user