-
Notifications
You must be signed in to change notification settings - Fork 450
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
Is the "in the future" calculation correct? #1161
Comments
We don’t know that. And we don’t need to, as having an aware post date and an aware |
Yes we do know it, dateutil.tz.tzlocal() gives you the current TZ |
Sorry, I’m not well-versed in dateutil, and did not know this. Sure thing — it does get the current TZ, from But still, we don’t really need the current timezone for this. |
If we use the conf.py TZ then move east, you will create every new post in the future, because it will combine the naive "now" with the conf.py TZ :-) |
So let’s not do naïve: let’s do UTC, and then it will combine aware UTC now and aware TZ — which will take care of itself. Besides, one cannot compare aware and naïve date-times. |
We are not comparing naive datetimes with non-naive ones, we are taking a naive one taken from the system clock, and blindly assigning a TZ that's not the system clock's to it. I'll propose a branch to "do the right thing". |
What we are doing now is: we are comparing the post's date (with the TZ expressed in the date or in conf.py) against the current naive datetime with the TZ from conf.py applied.
I suspect it would make more sense to use a non-naive now() with the system's current TZ?
The text was updated successfully, but these errors were encountered: