From 460707d04f0746667c0b709de6f94f7161156793 Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Mon, 21 Oct 2024 20:53:35 +0200 Subject: [PATCH] LDEV-5115 - switch to DateTimeFormatter --- .../displayFormatting/DateTimeFormat.java | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/lucee/runtime/functions/displayFormatting/DateTimeFormat.java b/core/src/main/java/lucee/runtime/functions/displayFormatting/DateTimeFormat.java index 6bd6370fc3..e7e07f5ef2 100644 --- a/core/src/main/java/lucee/runtime/functions/displayFormatting/DateTimeFormat.java +++ b/core/src/main/java/lucee/runtime/functions/displayFormatting/DateTimeFormat.java @@ -317,10 +317,62 @@ else if (len > 0 && sb.charAt(len - 1) == ONE) { str = StringUtil.replace(str, ZEROZERO, "''", false); str = str.replace(ONE, 'E'); str = y2yyyy(str); + + // TODO find a better way while ((str.indexOf("aa")) != -1) { str = StringUtil.replace(str, "aa", "a", false, true); } - + while ((str.indexOf("ddddd")) != -1) { + str = StringUtil.replace(str, "ddddd", "dddd", false, true); + } + while ((str.indexOf("DDDDD")) != -1) { + str = StringUtil.replace(str, "DDDDD", "DDDD", false, true); + } + while ((str.indexOf("EEEEE")) != -1) { + str = StringUtil.replace(str, "EEEEE", "EEEE", false, true); + } + while ((str.indexOf("GGG")) != -1) { + str = StringUtil.replace(str, "GGG", "GG", false, true); + } + while ((str.indexOf("HHH")) != -1) { + str = StringUtil.replace(str, "HHH", "HH", false, true); + } + while ((str.indexOf("hhh")) != -1) { + str = StringUtil.replace(str, "hhh", "hh", false, true); + } + while ((str.indexOf("KKK")) != -1) { + str = StringUtil.replace(str, "KKK", "KK", false, true); + } + while ((str.indexOf("llll")) != -1) { + str = StringUtil.replace(str, "llll", "lll", false, true); + } + while ((str.indexOf("LLLL")) != -1) { + str = StringUtil.replace(str, "LLLL", "LLL", false, true); + } + while ((str.indexOf("MMMMM")) != -1) { + str = StringUtil.replace(str, "MMMMM", "MMMM", false, true); + } + while ((str.indexOf("mmmmm")) != -1) { + str = StringUtil.replace(str, "mmmmm", "mmmm", false, true); + } + while ((str.indexOf("nnn")) != -1) { + str = StringUtil.replace(str, "nnn", "nn", false, true); + } + while ((str.indexOf("NNN")) != -1) { + str = StringUtil.replace(str, "NNN", "NN", false, true); + } + while ((str.indexOf("sss")) != -1) { + str = StringUtil.replace(str, "sss", "ss", false, true); + } + while ((str.indexOf("SSS")) != -1) { + str = StringUtil.replace(str, "SSS", "SS", false, true); + } + while ((str.indexOf("www")) != -1) { + str = StringUtil.replace(str, "www", "ww", false, true); + } + while ((str.indexOf("WWW")) != -1) { + str = StringUtil.replace(str, "WWW", "WW", false, true); + } return str; }