Update opening hours (fix osm)

This commit is contained in:
Victor Shcherb 2018-04-26 00:24:12 +02:00
parent 849c3849b4
commit d553e2ae72

View file

@ -38,11 +38,11 @@ public class OpeningHoursParser {
static {
DateFormatSymbols dateFormatSymbols = DateFormatSymbols.getInstance(Locale.US);
monthsStr = dateFormatSymbols.getShortMonths();
daysStr = getTwoLettersStringArray(dateFormatSymbols.getShortWeekdays());
daysStr = getLettersStringArray(dateFormatSymbols.getShortWeekdays(), 2);
dateFormatSymbols = DateFormatSymbols.getInstance();
localMothsStr = dateFormatSymbols.getShortMonths();
localDaysStr = getTwoLettersStringArray(dateFormatSymbols.getShortWeekdays());
localDaysStr = getLettersStringArray(dateFormatSymbols.getShortWeekdays(), 3);
additionalStrings.put("off", "off");
additionalStrings.put("is_open", "Open");
@ -75,12 +75,12 @@ public class OpeningHoursParser {
*/
private static String endOfDay = "24:00";
private static String[] getTwoLettersStringArray(String[] strings) {
private static String[] getLettersStringArray(String[] strings, int letters) {
String[] newStrings = new String[strings.length];
for (int i = 0; i < strings.length; i++) {
if (strings[i] != null) {
if (strings[i].length() > 3) {
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i].substring(0, 3));
if (strings[i].length() > letters) {
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i].substring(0, letters));
} else {
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i]);
}