diff --git a/sohstationviewer/view/date_edit_with_doy.py b/sohstationviewer/view/date_edit_with_doy.py
index 4569ead7e3ecc209a2addea6d423454d26a5ba1d..db7445ce1cba096eb9eac47d9adf359667e68fe2 100644
--- a/sohstationviewer/view/date_edit_with_doy.py
+++ b/sohstationviewer/view/date_edit_with_doy.py
@@ -1,4 +1,4 @@
-from PySide6.QtCore import Qt, QDate
+from PySide6.QtCore import Qt
 from PySide6.QtGui import (
     QKeyEvent, QWheelEvent, QContextMenuEvent, QAction,
 )
@@ -19,7 +19,7 @@ class DayOfYearSupportedDateTextBox(QDateEdit):
         super().__init__(date, parent, *args, **kwargs)
         self.dateChanged.connect(self.on_date_changed)
         # Store the current display format so that we know if 'DOY' is in it.
-        self._display_format = ''
+        self._raw_display_format = ''
 
     def keyPressEvent(self, event: QKeyEvent):
         """
@@ -38,19 +38,12 @@ class DayOfYearSupportedDateTextBox(QDateEdit):
             return
         super().keyPressEvent(event)
 
-    def on_date_changed(self, date: QDate):
+    def on_date_changed(self):
         """
-        On the stored date being changed, reformat and reset the date format if
-        the stored format contains 'DOY'.
-
-        :param date: the new data
+        On the stored date being changed, reset the date format so that the
+        displayed date can be formatted correctly.
         """
-        if 'DOY' in self._display_format:
-            format = self._display_format.replace(
-                'DOY',
-                f"'{str(date.dayOfYear())}'"
-            )
-            self.setDisplayFormat(format)
+        self.setDisplayFormat(self._raw_display_format)
 
     def wheelEvent(self, event: QWheelEvent):
         """
@@ -88,6 +81,9 @@ class DayOfYearSupportedDateTextBox(QDateEdit):
         menu.addAction(select_all_action)
         menu.exec(event.globalPos())
 
+    def displayFormat(self) -> str:
+        return self._raw_display_format
+
     def setDisplayFormat(self, format):
         """
         If 'DOY' is in format, replace it with the day of year of the date
@@ -97,7 +93,7 @@ class DayOfYearSupportedDateTextBox(QDateEdit):
 
         :param format: the date format being set.
         """
+        self._raw_display_format = format
         if 'DOY' in format:
-            self._display_format = format
             format = format.replace('DOY', f"{str(self.date().dayOfYear())}")
         super().setDisplayFormat(format)