Skip to content

is_utc() returns False when parsing from a UTC date #293

@joaonc

Description

@joaonc

This date is UTC: '2018-06-21T09:30:00+00:00', however, the is_utc() method returns False.

>>> pendulum.parse('2018-06-21T09:30:00+00:00').timezone
Timezone('+00:00')

>>> pendulum.parse('2018-06-21T09:30:00+00:00').is_utc()
False

The current implementation is:

    def is_utc(self):
        return self.timezone_name == 'UTC'

Maybe it can be something like:

    def is_utc(self):
        return self.timezone.offset == 0

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