Title: [BUG] Job_queue is skipping job if timezone is not provided for job.run_daily · Issue #1693 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: [BUG] Job_queue is skipping job if timezone is not provided for job.run_daily · Issue #1693 · python-telegram-bot/python-telegram-bot
X Title: [BUG] Job_queue is skipping job if timezone is not provided for job.run_daily · Issue #1693 · python-telegram-bot/python-telegram-bot
Description: For example, my local timezone is +3 UTC and I want to run job every working day at 23:00 UTC. launch_time.tzinfo is None so it's expected to be interpreted as 23:00 UTC. launch_time = dtm.time(hour=23) job = job_queue.run_daily(run_once...
Open Graph Description: For example, my local timezone is +3 UTC and I want to run job every working day at 23:00 UTC. launch_time.tzinfo is None so it's expected to be interpreted as 23:00 UTC. launch_time = dtm.time(hou...
X Description: For example, my local timezone is +3 UTC and I want to run job every working day at 23:00 UTC. launch_time.tzinfo is None so it's expected to be interpreted as 23:00 UTC. launch_time = dtm.time...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/1693
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] Job_queue is skipping job if timezone is not provided for job.run_daily","articleBody":"For example, my local timezone is +3 UTC and I want to run job every working day at 23:00 UTC.\r\n\r\n`launch_time.tzinfo` is `None` so it's expected to be interpreted as 23:00 UTC.\r\n```python\r\nlaunch_time = dtm.time(hour=23)\r\njob = job_queue.run_daily(run_once, launch_time,\r\n days=(0, 1, 3, 4))\r\n```\r\n\r\nSince `launch_time.tzinfo` was `None`, `job.tzinfo` is also equals `None` because of the following code from `JobQueue.run_daily` https://github.com/python-telegram-bot/python-telegram-bot/blob/3d42df3366d7cff030c3ce06d6a95259b3bdf62e/telegram/ext/jobqueue.py#L225-L232\r\n\r\nLet's assume now is 23:00 UTC Friday. \r\n\r\nThe following code from `JobQueue.tick` won't run the job because \r\n1) `datetime.datetime.now(None)` returns local time and local time now is 02:00 Saturday.\r\n2) then `datetime.datetime.now(job.tzinfo).date().weekday()` will return `5`\r\n3) `any(day == current_week_day for day in job.days)` will return `False` because we're looking for `(0, 1, 3, 4)`\r\nSo job won't be run until 23:00 UTC Sunday.\r\nhttps://github.com/python-telegram-bot/python-telegram-bot/blob/3d42df3366d7cff030c3ce06d6a95259b3bdf62e/telegram/ext/jobqueue.py#L275-L280\r\n\r\n\r\nAnd one more thing - when #1685 will be merged, in the described case `Job.next_t` will be returning local time when utc time is expected:\r\n```python\r\n @property\r\n def next_t(self):\r\n return datetime.datetime.fromtimestamp(self._next_t, self.tzinfo) if self._next_t else None\r\n\r\n```\r\n","author":{"url":"https://github.com/Andrej730","@type":"Person","name":"Andrej730"},"datePublished":"2020-01-05T14:17:47Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/1693"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c72bae55-580b-189e-e6f2-9302bf27fb3c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C948:EA06E:574A59C:6E5434C:6B02781C |
| html-safe-nonce | ee25ebbcae9133022211c4992a8ce8bcbc190219ee63abe83466d466e954fb70 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTQ4OkVBMDZFOjU3NEE1OUM6NkU1NDM0Qzo2QjAyNzgxQyIsInZpc2l0b3JfaWQiOiIyMTAyNDg5NzMxMzE2MjE3ODg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 01c8c99ba36916ab24560e708c1b7e2ae3eed79cdc2fc7fdb29e176a1f6e3f9f |
| hovercard-subject-tag | issue:545423333 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-telegram-bot/python-telegram-bot/1693/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5dfe06398d820d8b21189ddb6c5ba6209d707d509f6cc1a849e739d1647f9ab8/python-telegram-bot/python-telegram-bot/issues/1693 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5dfe06398d820d8b21189ddb6c5ba6209d707d509f6cc1a849e739d1647f9ab8/python-telegram-bot/python-telegram-bot/issues/1693 |
| og:image:alt | For example, my local timezone is +3 UTC and I want to run job every working day at 23:00 UTC. launch_time.tzinfo is None so it's expected to be interpreted as 23:00 UTC. launch_time = dtm.time(hou... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Andrej730 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git |
| octolytics-dimension-user_id | 16178365 |
| octolytics-dimension-user_login | python-telegram-bot |
| octolytics-dimension-repository_id | 38696925 |
| octolytics-dimension-repository_nwo | python-telegram-bot/python-telegram-bot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38696925 |
| octolytics-dimension-repository_network_root_nwo | python-telegram-bot/python-telegram-bot |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width