-
-
Notifications
You must be signed in to change notification settings - Fork 384
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
tz not taken into account when calling pendulum.instance #841
Comments
I think what you need is
or even if actually using
The instance method is I believe more intended for datetime.datetime conversion (into pendulum.Datetime). |
Yeah we already have our fix, I just wanted to report this behavior by the |
My best guess is that pendulum.instance expects a datetime.datetime with a tzinfo attributes, not a pendulum.Datetime, as the point of |
Ah ok here is what happens:
If you pass a pendulum DateTime as argument it will have a tzinfo, so this will take priority over the one you injected. But again I don't think this method is intended to perform time zone conversions as discussed above. |
Issue
If you pass a DateTime that has timezone information, for example
pendulum.now()
, topendulum.instance()
, thetz=
argument seems to do nothing.Try for example the following:
pendulum.instance(pendulum.now(), tz="EST")
For me, that returns
DateTime(2024, 9, 3, 13, 56, 35, 64854, tzinfo=Timezone('Europe/Brussels'))
since I am in Brussels.I would expect this
tz=
argument forinstance
to make sure the returned object is in that timezone. If not, what is it used for?The text was updated successfully, but these errors were encountered: