Skip to content

pendulum.now() is inconsistent when using the TZ env variable #497

Description

@guiwoda

Example, when using TZ=Europe/Berlin

>>> import pendulum
>>> pendulum.now()
<Pendulum [2020-09-01T18:53:49.977333+02:00]>
>>> pendulum.now(tz='Europe/Berlin')
<Pendulum [2020-09-01T20:54:02.361281+02:00]>
>>> pendulum.now().timezone.name
'Europe/Berlin'
>>> pendulum.now(tz='Europe/Berlin').timezone.name
'Europe/Berlin'

The correct time was 18:53 (the one given without the tz parameter). It seems that, if tz is sent, it doesn't check what the system date timezone is and assumes it's on UTC, so it moved it to +2 when it shouldn't.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions