mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-69425 (era format specifier substitution for Windows)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -424,15 +424,15 @@ public class DateFormatUtil {
|
||||
|
||||
rv = kernel32.GetLocaleInfoEx(Kernel32.LOCALE_NAME_USER_DEFAULT, Kernel32.LOCALE_SSHORTDATE, data, dataSize);
|
||||
assert rv > 1 : kernel32.GetLastError();
|
||||
String shortDate = new String(data.getCharArray(0, rv - 1));
|
||||
String shortDate = fixWindowsFormat(new String(data.getCharArray(0, rv - 1)));
|
||||
|
||||
rv = kernel32.GetLocaleInfoEx(Kernel32.LOCALE_NAME_USER_DEFAULT, Kernel32.LOCALE_SSHORTTIME, data, dataSize);
|
||||
assert rv > 1 : kernel32.GetLastError();
|
||||
String shortTime = StringUtil.replace(new String(data.getCharArray(0, rv - 1)), "tt", "a");
|
||||
String shortTime = fixWindowsFormat(new String(data.getCharArray(0, rv - 1)));
|
||||
|
||||
rv = kernel32.GetLocaleInfoEx(Kernel32.LOCALE_NAME_USER_DEFAULT, Kernel32.LOCALE_STIMEFORMAT, data, dataSize);
|
||||
assert rv > 1 : kernel32.GetLastError();
|
||||
String mediumTime = StringUtil.replace(new String(data.getCharArray(0, rv - 1)), "tt", "a");
|
||||
String mediumTime = fixWindowsFormat(new String(data.getCharArray(0, rv - 1)));
|
||||
|
||||
formats[0] = new SimpleDateFormat(shortDate);
|
||||
formats[1] = new SimpleDateFormat(shortTime);
|
||||
@@ -441,4 +441,10 @@ public class DateFormatUtil {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static String fixWindowsFormat(String format) {
|
||||
format = format.replaceAll("g+", "G");
|
||||
format = StringUtil.replace(format, "tt", "a");
|
||||
return format;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user