Page MenuHomePhabricator

pywikibot.WbTime.toTimestamp discards timezone information
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

ts1 = pywikibot.Timestamp(
    year=2022, month=12, day=21, hour=13,
    tzinfo=datetime.timezone(datetime.timedelta(hours=-5)))
t1 = pywikibot.WbTime.fromTimestamp(ts1, timezone=-300)
t1.toTimestamp() == ts1

What happens?: The equality is false.

What should have happened instead?: The equality is true

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.): For backwards compatibility, I'll introduce a parameter keep_timezone that adds the timezone in.

Event Timeline

RPI2026F1 changed the task status from Open to In Progress.Dec 23 2022, 3:44 AM
RPI2026F1 claimed this task.
RPI2026F1 triaged this task as Low priority.

Change 871019 had a related patch set uploaded (by RPI2026F1; author: RPI2026F1):

[pywikibot/core@master] [Bugfix] Add pass_timzone to toTimestamp()

https://gerrit.wikimedia.org/r/871019

Change 871019 merged by jenkins-bot:

[pywikibot/core@master] [Bugfix] Add timezone_aware to toTimestamp()

https://gerrit.wikimedia.org/r/871019