Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.

fix wrong date format for German language #184

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mobile/src/main/java/net/etuldan/sparss/utils/StringUtils.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public class StringUtils {
Expand All @@ -46,6 +47,9 @@ public class StringUtils {
DATE_SHORT_FORMAT = new SimpleDateFormat(android.text.format.DateFormat.getBestDateTimePattern(MainApplication.getContext().getResources().getConfiguration().locale, "d MMM"));
} else {
DATE_SHORT_FORMAT = android.text.format.DateFormat.getDateFormat(MainApplication.getContext());
if(Locale.getDefault().equals(Locale.GERMANY) && (((SimpleDateFormat)DATE_SHORT_FORMAT).toLocalizedPattern()).equals("MM.dd.yyyy")) { //workaround for Android issue with German language
DATE_SHORT_FORMAT = new SimpleDateFormat("dd.MM.yyyy");
}
}
}

Expand Down