Timezone issue with relation to script jobs and changelogs #9599

Closed
opened 2025-12-29 21:19:31 +01:00 by adam · 5 comments
Owner

Originally created by @bitcollector1 on GitHub (May 7, 2024).

Deployment Type

Self-hosted

NetBox Version

v4.0.0

Python Version

3.12

Steps to Reproduce

  1. Schedule a job to run a script on 5/6/2024 @ 20:00
Screenshot 2024-05-06 at 19 50 52
  1. View the Job and notice it's scheduled using UTC time
Screenshot 2024-05-06 at 19 51 12
  1. Verify correct time is set in NetBox GUI
    Screenshot 2024-05-06 at 19 50 17

NetBox Config:
Screenshot 2024-05-06 at 19 51 56

System time:
Screenshot 2024-05-06 at 19 50 31

Expected Behavior

Script is scheduled using the same time that NetBox and System is using.

Observed Behavior

Script and changlogs seem to be using UTC time and not respecting user settings.

Originally created by @bitcollector1 on GitHub (May 7, 2024). ### Deployment Type Self-hosted ### NetBox Version v4.0.0 ### Python Version 3.12 ### Steps to Reproduce 1. Schedule a job to run a script on 5/6/2024 @ 20:00 <img width="1016" alt="Screenshot 2024-05-06 at 19 50 52" src="https://github.com/netbox-community/netbox/assets/50723251/95e97a49-71a4-4b0e-a56a-8ea364f15fca"> 2. View the Job and notice it's scheduled using UTC time <img width="1323" alt="Screenshot 2024-05-06 at 19 51 12" src="https://github.com/netbox-community/netbox/assets/50723251/8c3268c5-24ad-46e4-b424-6cda26e0008d"> 3. Verify correct time is set in NetBox GUI <img width="344" alt="Screenshot 2024-05-06 at 19 50 17" src="https://github.com/netbox-community/netbox/assets/50723251/82b09ab5-7658-4f10-aa48-7e31006922db"> NetBox Config: <img width="684" alt="Screenshot 2024-05-06 at 19 51 56" src="https://github.com/netbox-community/netbox/assets/50723251/80a50b06-4ac8-406a-855b-bdc0279e33de"> System time: <img width="298" alt="Screenshot 2024-05-06 at 19 50 31" src="https://github.com/netbox-community/netbox/assets/50723251/1fe744ad-bb36-4e91-af4d-82a942f63e93"> ### Expected Behavior Script is scheduled using the same time that NetBox and System is using. ### Observed Behavior Script and changlogs seem to be using UTC time and not respecting user settings.
adam added the type: bug label 2025-12-29 21:19:31 +01:00
adam closed this issue 2025-12-29 21:19:31 +01:00
Author
Owner

@bitcollector1 commented on GitHub (May 7, 2024):

The Script completed successfully, it's just that this time issue seems to have shown up in NetBox 4.0

Screenshot 2024-05-06 at 20 06 07
@bitcollector1 commented on GitHub (May 7, 2024): The Script completed successfully, it's just that this time issue seems to have shown up in NetBox 4.0 <img width="1302" alt="Screenshot 2024-05-06 at 20 06 07" src="https://github.com/netbox-community/netbox/assets/50723251/4c2d284c-b333-403c-8513-93174e13d5c3">
Author
Owner

@bitcollector1 commented on GitHub (May 10, 2024):

Related case:
15983
pull/16065

I now understand how/why Django uses UTC. In the case above a new "results" column was added and I was able to get my time formatted to my timezone with the following bit of code

{{ record.completed.astimezone.isoformat }}
Screenshot 2024-05-09 at 21 01 30

My guess is this is as good as it's going to get; the date picker and the new results column, with my correct timezone that matches the date picker should be good enough :)

Now we just need to get the new "results" column ported over to the main jobs page.
/core/jobs/

This stuff is super confusing to a noob like myself.....but this has been a great primer for my desire to build a plugin :)

@bitcollector1 commented on GitHub (May 10, 2024): Related case: [15983](https://github.com/netbox-community/netbox/issues/15983) [pull/16065](https://github.com/netbox-community/netbox/pull/16065) I now understand how/why Django uses UTC. In the case above a new "results" column was added and I was able to get my time formatted to my timezone with the following bit of code ``` {{ record.completed.astimezone.isoformat }} ``` <img width="1291" alt="Screenshot 2024-05-09 at 21 01 30" src="https://github.com/netbox-community/netbox/assets/50723251/7023fb80-c49d-404f-a940-867ff7f2c65a"> My guess is this is as good as it's going to get; the date picker and the new results column, with my correct timezone that matches the date picker should be good enough :) Now we just need to get the new "results" column ported over to the main jobs page. */core/jobs/* This stuff is super confusing to a noob like myself.....but this has been a great primer for my desire to build a plugin :)
Author
Owner

@bitcollector1 commented on GitHub (May 10, 2024):

Pretty sure this case can be closed out. It just took me a little while to digest all of the changes from 3.7.x to 4.0

@bitcollector1 commented on GitHub (May 10, 2024): Pretty sure this case can be closed out. It just took me a little while to digest all of the changes from 3.7.x to 4.0
Author
Owner

@bitcollector1 commented on GitHub (May 10, 2024):

It still would be nice to have the change logs to produce the time that is configured on the system, if it's not too much trouble.

Cheers!

@bitcollector1 commented on GitHub (May 10, 2024): It still would be nice to have the change logs to produce the time that is configured on the system, if it's not too much trouble. Cheers!
Author
Owner

@arthanson commented on GitHub (May 13, 2024):

It still would be nice to have the change logs to produce the time that is configured on the system, if it's not too much trouble.

@bitcollector1 please open a feature-request for the above if you still think it is valid. Closing this bug as you it can be closed out.

@arthanson commented on GitHub (May 13, 2024): > It still would be nice to have the change logs to produce the time that is configured on the system, if it's not too much trouble. @bitcollector1 please open a feature-request for the above if you still think it is valid. Closing this bug as you it can be closed out.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9599