From 1d97c73ddd51c122b067951ba4198f079f847028 Mon Sep 17 00:00:00 2001 From: mattknatt Date: Mon, 27 Apr 2026 07:36:33 +0200 Subject: [PATCH 1/2] Add `WebConfig` with `Instant` to `String` converter and update templates for consistent date formatting --- .../infrastructure/config/WebConfig.java | 21 +++++++++++++++++++ .../resources/templates/cases/closed.html | 2 +- .../resources/templates/cases/detail.html | 6 +++--- src/main/resources/templates/cases/list.html | 2 +- .../resources/templates/employees/list.html | 2 +- .../resources/templates/patients/list.html | 2 +- 6 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 src/main/java/org/example/projektarendehantering/infrastructure/config/WebConfig.java diff --git a/src/main/java/org/example/projektarendehantering/infrastructure/config/WebConfig.java b/src/main/java/org/example/projektarendehantering/infrastructure/config/WebConfig.java new file mode 100644 index 0000000..ce484b4 --- /dev/null +++ b/src/main/java/org/example/projektarendehantering/infrastructure/config/WebConfig.java @@ -0,0 +1,21 @@ +package org.example.projektarendehantering.infrastructure.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.converter.Converter; + +import java.time.Instant; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; + +@Configuration +public class WebConfig { + + private static final DateTimeFormatter DISPLAY_FORMAT = + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").withZone(ZoneId.of("Europe/Stockholm")); + + @Bean + public Converter instantToStringConverter() { + return DISPLAY_FORMAT::format; + } +} diff --git a/src/main/resources/templates/cases/closed.html b/src/main/resources/templates/cases/closed.html index ad08449..9e3e9d0 100644 --- a/src/main/resources/templates/cases/closed.html +++ b/src/main/resources/templates/cases/closed.html @@ -23,7 +23,7 @@

Closed Cases

Title - Date + Date View diff --git a/src/main/resources/templates/cases/detail.html b/src/main/resources/templates/cases/detail.html index cb21737..808fb66 100644 --- a/src/main/resources/templates/cases/detail.html +++ b/src/main/resources/templates/cases/detail.html @@ -38,7 +38,7 @@

Case

Created At
-
Date
+
Date

@@ -75,7 +75,7 @@

Notes

Note content

Author - - Date + Date

No notes yet.

@@ -100,7 +100,7 @@

Documents

Document.pdf
123.4 KB - - Date + Date
Cases Title - Date + Date User Mappings (Employees) Username Role UUID - Date + Date Edit Registered Patients First Last PIN - Date + Date Edit From 22942bea118608e955d82119f8ea7bebbca98792 Mon Sep 17 00:00:00 2001 From: mattknatt Date: Mon, 27 Apr 2026 07:45:33 +0200 Subject: [PATCH 2/2] Update date format in `WebConfig` and simplify template date handling --- .../projektarendehantering/infrastructure/config/WebConfig.java | 2 +- src/main/resources/templates/audit/list.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/example/projektarendehantering/infrastructure/config/WebConfig.java b/src/main/java/org/example/projektarendehantering/infrastructure/config/WebConfig.java index ce484b4..00476a7 100644 --- a/src/main/java/org/example/projektarendehantering/infrastructure/config/WebConfig.java +++ b/src/main/java/org/example/projektarendehantering/infrastructure/config/WebConfig.java @@ -12,7 +12,7 @@ public class WebConfig { private static final DateTimeFormatter DISPLAY_FORMAT = - DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").withZone(ZoneId.of("Europe/Stockholm")); + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.of("Europe/Stockholm")); @Bean public Converter instantToStringConverter() { diff --git a/src/main/resources/templates/audit/list.html b/src/main/resources/templates/audit/list.html index 04a228c..fae46f5 100644 --- a/src/main/resources/templates/audit/list.html +++ b/src/main/resources/templates/audit/list.html @@ -214,7 +214,7 @@

Audit Log

- time + time
role
actor