-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable harmonised date time rendering (#946)
Because it is just annoying to present users with a ISO8601 unformatted timestamp.
- Loading branch information
Showing
3 changed files
with
35 additions
and
7 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
user-interface/src/main/java/life/qbic/datamanager/views/general/DateTimeRendering.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package life.qbic.datamanager.views.general; | ||
|
||
import java.time.Instant; | ||
import java.time.ZoneId; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
/** | ||
* <b>Date Time Rendering</b> | ||
* | ||
* <p>A collection of utility methods to render instants in a harmonised way throughout the | ||
* application.</p> | ||
* | ||
* @since 1.7.0 | ||
*/ | ||
public class DateTimeRendering { | ||
|
||
private static final String DATE_TIME_PATTERN = "dd.MM.yyyy HH:mm"; | ||
|
||
/** | ||
* Formats an {@link Instant} in "dd.MM.yyyy HH:mm". | ||
* | ||
* @param instant the instant to format | ||
* @return the formatted instant | ||
* @since 1.7.0 | ||
*/ | ||
public static String simple(Instant instant) { | ||
var formatter = DateTimeFormatter.ofPattern(DATE_TIME_PATTERN).withZone(ZoneId.systemDefault()); | ||
return formatter.format(instant); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters