[PR #17267] [MERGED] Fixes: #17108 - Update isotime and isodate filters to be timezone-aware #15037

Closed
opened 2025-12-30 00:19:35 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/17267
Author: @bctiemann
Created: 8/26/2024
Status: Merged
Merged: 8/26/2024
Merged by: @jeremystretch

Base: developHead: 17108-localtime-for-scripts


📝 Commits (2)

  • 07ad4c1 Update isotime and isodate filters to be timezone-aware for display in templates (particularly Scripts)
  • 4095640 Handle naive datetimes gracefully

📊 Changes

3 files changed (+7 additions, -4 deletions)

View changed files

📝 netbox/extras/forms/reports.py (+1 -1)
📝 netbox/extras/forms/scripts.py (+1 -1)
📝 netbox/utilities/templatetags/builtins/filters.py (+5 -2)

📄 Description

Fixes: #17108 - Update isotime and isodate filters to be timezone-aware

Wraps the logic of the isodate and isotime filters in the Django localtime util, with the (potentially widespread) effect that every appearance of a datetime in the UI will now respect the TIME_ZONE setting. This particularly fixes the job scheduling UI as seen below (note also that the "Current time" output also now reflects the timezone for added clarity):

Screenshot 2024-08-26 at 11 14 19 AM Screenshot 2024-08-26 at 11 16 56 AM Screenshot 2024-08-26 at 11 19 52 AM

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/17267 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 8/26/2024 **Status:** ✅ Merged **Merged:** 8/26/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `17108-localtime-for-scripts` --- ### 📝 Commits (2) - [`07ad4c1`](https://github.com/netbox-community/netbox/commit/07ad4c1c9c6ee0300f0e55be93e932d4661f179a) Update isotime and isodate filters to be timezone-aware for display in templates (particularly Scripts) - [`4095640`](https://github.com/netbox-community/netbox/commit/409564091dee9633660370b1b2b01dbb82826de3) Handle naive datetimes gracefully ### 📊 Changes **3 files changed** (+7 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/forms/reports.py` (+1 -1) 📝 `netbox/extras/forms/scripts.py` (+1 -1) 📝 `netbox/utilities/templatetags/builtins/filters.py` (+5 -2) </details> ### 📄 Description ### Fixes: #17108 - Update isotime and isodate filters to be timezone-aware Wraps the logic of the `isodate` and `isotime` filters in the Django `localtime` util, with the (potentially widespread) effect that every appearance of a datetime in the UI will now respect the `TIME_ZONE` setting. This particularly fixes the job scheduling UI as seen below (note also that the "Current time" output also now reflects the timezone for added clarity): <img width="831" alt="Screenshot 2024-08-26 at 11 14 19 AM" src="https://github.com/user-attachments/assets/9a1be422-de16-4a8e-9626-9db98d152ac8"> <img width="590" alt="Screenshot 2024-08-26 at 11 16 56 AM" src="https://github.com/user-attachments/assets/8daec8fe-6904-4dbd-a752-b4ad4a8397f4"> <img width="595" alt="Screenshot 2024-08-26 at 11 19 52 AM" src="https://github.com/user-attachments/assets/205d4760-6fbb-497f-886e-a94c62747573"> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:19:35 +01:00
adam closed this issue 2025-12-30 00:19:35 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15037