Skip to content

Fix pendulum.parse('now', tz='...') ignoring the time zone #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

pR0Ps
Copy link
Contributor

@pR0Ps pR0Ps commented Apr 5, 2023

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code (nothing to update - as far as I can tell this isn't mentioned in it).

Previously, using "now" with pendulum.parse short-circuited all other parsing logic (expected), including the time zone (not expected).

Example using the latest release:

>>> import pendulum
>>> pendulum.__version__
'2.1.2'
>>> pendulum.parse("2023-04-04", tz="America/Los_Angeles").format("z (Z)")
'America/Los_Angeles (-07:00)'
>>> pendulum.parse("now", tz="America/Los_Angeles").format("z (Z)")
'Etc/UTC (-00:00)'

The same example after this PR:

>>> import pendulum
>>> pendulum.__version__
'3.0.0a'
>>> pendulum.parse("2023-04-04", tz="America/Los_Angeles").format("z (Z)")
'America/Los_Angeles (-07:00)'
>>> pendulum.parse("now", tz="America/Los_Angeles").format("z (Z)")
'America/Los_Angeles (-07:00)'

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 5, 2023

CodSpeed Performance Report

Merging #701 will not alter performance

Comparing pR0Ps:bugfix/parse-now-timezone (305f80f) with master (1034b18)

Summary

✅ 1 untouched benchmarks

@pR0Ps pR0Ps force-pushed the bugfix/parse-now-timezone branch from 84d8c3d to 6c8a5cc Compare January 17, 2024 01:40
@pR0Ps pR0Ps force-pushed the bugfix/parse-now-timezone branch 2 times, most recently from 8d5cbef to 3313f1b Compare September 9, 2024 03:47
@pR0Ps
Copy link
Contributor Author

pR0Ps commented Sep 9, 2024

@edgarrmondragon Anything else for me to do on this?

@edgarrmondragon
Copy link
Contributor

@edgarrmondragon Anything else for me to do on this?

I'll preface saying I'm not a maintainer of this repo, so my approval is only nominal 🙂.

This LGTM, there's a Rust linting error but I don't know if it's related to changes in this PR.

@Secrus
Copy link
Collaborator

Secrus commented Apr 23, 2025

Hi. Sorry for the delays, we are digging ourselves out of the pile of code debt. Could you please rebase your changes with the master branch so we can review and merge them?

@pR0Ps pR0Ps force-pushed the bugfix/parse-now-timezone branch from 3313f1b to 305f80f Compare April 24, 2025 01:58
@pR0Ps
Copy link
Contributor Author

pR0Ps commented Apr 24, 2025

@Secrus rebased on latest master

@Secrus Secrus merged commit 9826867 into python-pendulum:master Apr 24, 2025
18 checks passed
@pR0Ps pR0Ps deleted the bugfix/parse-now-timezone branch April 24, 2025 12:09
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.

3 participants