diff --git a/docs/release-notes/version-3.4.md b/docs/release-notes/version-3.4.md
index 84882dd58..79f57a90c 100644
--- a/docs/release-notes/version-3.4.md
+++ b/docs/release-notes/version-3.4.md
@@ -11,6 +11,7 @@
### Bug Fixes
+* [#11384](https://github.com/netbox-community/netbox/issues/11384) - Correct current time display on script & report forms
* [#11403](https://github.com/netbox-community/netbox/issues/11403) - Fix exception when scheduling a job in the past
---
diff --git a/netbox/extras/forms/reports.py b/netbox/extras/forms/reports.py
index 338d05fa3..d2ec01006 100644
--- a/netbox/extras/forms/reports.py
+++ b/netbox/extras/forms/reports.py
@@ -3,6 +3,7 @@ from django.utils import timezone
from django.utils.translation import gettext as _
from utilities.forms import BootstrapMixin, DateTimePicker, SelectDurationWidget
+from utilities.utils import local_now
__all__ = (
'ReportForm',
@@ -35,5 +36,5 @@ class ReportForm(BootstrapMixin, forms.Form):
super().__init__(*args, **kwargs)
# Annotate the current system time for reference
- now = timezone.now().strftime('%Y-%m-%d %H:%M:%S')
+ now = local_now().strftime('%Y-%m-%d %H:%M:%S')
self.fields['schedule_at'].help_text += f' (current time: {now})'
diff --git a/netbox/extras/forms/scripts.py b/netbox/extras/forms/scripts.py
index e61bb111d..79dc8c869 100644
--- a/netbox/extras/forms/scripts.py
+++ b/netbox/extras/forms/scripts.py
@@ -1,8 +1,8 @@
from django import forms
-from django.utils import timezone
from django.utils.translation import gettext as _
from utilities.forms import BootstrapMixin, DateTimePicker, SelectDurationWidget
+from utilities.utils import local_now
__all__ = (
'ScriptForm',
@@ -34,7 +34,7 @@ class ScriptForm(BootstrapMixin, forms.Form):
super().__init__(*args, **kwargs)
# Annotate the current system time for reference
- now = timezone.now().strftime('%Y-%m-%d %H:%M:%S')
+ now = local_now().strftime('%Y-%m-%d %H:%M:%S')
self.fields['_schedule_at'].help_text += f' (current time: {now})'
# Move _commit and _schedule_at to the end of the form
diff --git a/netbox/utilities/utils.py b/netbox/utilities/utils.py
index f635fc728..38a974036 100644
--- a/netbox/utilities/utils.py
+++ b/netbox/utilities/utils.py
@@ -12,6 +12,8 @@ from django.db.models import Count, OuterRef, Subquery
from django.db.models.functions import Coalesce
from django.http import QueryDict
from django.utils.html import escape
+from django.utils import timezone
+from django.utils.timezone import localtime
from jinja2.sandbox import SandboxedEnvironment
from mptt.models import MPTTModel
@@ -527,3 +529,10 @@ def highlight_string(value, highlight, trim_pre=None, trim_post=None, trim_place
post = post[:trim_post] + trim_placeholder
return f'{escape(pre)}{escape(match)}{escape(post)}'
+
+
+def local_now():
+ """
+ Return the current date & time in the system timezone.
+ """
+ return localtime(timezone.now())