You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2020/11/19 13:38:03 UTC

[openmeetings] branch master updated: [OPENMEETINGS-2516] dates in bulgarian locale are fixed

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new ac5d6ec  [OPENMEETINGS-2516] dates in bulgarian locale are fixed
ac5d6ec is described below

commit ac5d6ec9a53579a04fdd005da8f3b0a7b9ed69b9
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Thu Nov 19 20:28:50 2020 +0700

    [OPENMEETINGS-2516] dates in bulgarian locale are fixed
---
 .../openmeetings/web/common/AbstractOmDateTimePicker.java      |  2 +-
 .../test/java/org/apache/openmeetings/util/TestDateTime.java   | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/AbstractOmDateTimePicker.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/AbstractOmDateTimePicker.java
index 96450c2..2c9e2d2 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/AbstractOmDateTimePicker.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/AbstractOmDateTimePicker.java
@@ -60,7 +60,7 @@ public abstract class AbstractOmDateTimePicker<T> extends AbstractDateTimePicker
 	public static String patch(String format) {
 		// in Java free text is escaped with single-quotes
 		// moment.js uses []
-		return format.replaceFirst("(.*)([']{1}(.*)[']{1})(.*)", "$1\\[$3\\]$4");
+		return format.replaceAll("[']{1}([^']*)[']{1}", "\\[$1\\]");
 	}
 
 	public static String getDateTimeFormat() {
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/util/TestDateTime.java b/openmeetings-web/src/test/java/org/apache/openmeetings/util/TestDateTime.java
index 8ba8566..8cd53d6 100644
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/util/TestDateTime.java
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/util/TestDateTime.java
@@ -86,4 +86,14 @@ class TestDateTime {
 		format = AbstractOmDateTimePicker.getDateTimeFormat(Locale.ENGLISH);
 		assertEquals(format, AbstractOmDateTimePicker.patch(format));
 	}
+
+	@Test
+	void test4() throws Exception {
+		final Locale loc = new Locale.Builder()
+				.setLanguage("bg")
+				.setRegion("BG")
+				.build();
+		String format = AbstractOmDateTimePicker.getDateTimeFormat(loc);
+		assertEquals("d.MM.yy [г]., H:mm [ч].", AbstractOmDateTimePicker.patch(format));
+	}
 }