From 186248ff63d5665d66a48232d98c6ac1880acd9a Mon Sep 17 00:00:00 2001 From: Emily Gouge Date: Thu, 7 Mar 2024 11:39:57 -0800 Subject: [PATCH 1/2] date format export fix --- .../src/main/java/org/jeometry/common/date/Dates.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jeometry-common/src/main/java/org/jeometry/common/date/Dates.java b/jeometry-common/src/main/java/org/jeometry/common/date/Dates.java index 0c97ef69..06befe84 100644 --- a/jeometry-common/src/main/java/org/jeometry/common/date/Dates.java +++ b/jeometry-common/src/main/java/org/jeometry/common/date/Dates.java @@ -91,6 +91,14 @@ static String format(final String pattern, final Date date) { } } + static String format(final String pattern, final LocalDate date) { + if (date == null) { + return null; + } else { + return DateTimeFormatter.ofPattern(pattern).format(date); + } + } + static Calendar getCalendar(final String dateString) { if (dateString != null) { final Matcher matcher = DATE_TIME_NANOS_PATTERN.matcher(dateString); @@ -451,7 +459,7 @@ static Timestamp getTimestamp(final String dateString) { if (dateString != null) { final Instant instant = Instant.parse(dateString); return Timestamp.from(instant); - } else { + } else { return null; } } From 699041408d172975fb6f6e7969112308e937245c Mon Sep 17 00:00:00 2001 From: Emily Gouge Date: Tue, 12 Mar 2024 12:19:15 -0700 Subject: [PATCH 2/2] static format --- .../java/org/jeometry/common/date/Dates.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/jeometry-common/src/main/java/org/jeometry/common/date/Dates.java b/jeometry-common/src/main/java/org/jeometry/common/date/Dates.java index 06befe84..2eb9ee88 100644 --- a/jeometry-common/src/main/java/org/jeometry/common/date/Dates.java +++ b/jeometry-common/src/main/java/org/jeometry/common/date/Dates.java @@ -64,6 +64,14 @@ static String format(final DateFormat format, final Date date) { return format.format(date); } + static String format(final DateTimeFormatter formatter, final LocalDate date) { + if (date == null) { + return null; + } else { + return formatter.format(date); + } + } + static String format(final int dateStyle, final int timeStyle, final Timestamp timestamp) { final DateFormat format = DateFormat.getDateTimeInstance(dateStyle, timeStyle); return format(format, timestamp); @@ -91,14 +99,6 @@ static String format(final String pattern, final Date date) { } } - static String format(final String pattern, final LocalDate date) { - if (date == null) { - return null; - } else { - return DateTimeFormatter.ofPattern(pattern).format(date); - } - } - static Calendar getCalendar(final String dateString) { if (dateString != null) { final Matcher matcher = DATE_TIME_NANOS_PATTERN.matcher(dateString);