mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Fix lint issue: Locale in date formats
This commit is contained in:
parent
5ccd24eb33
commit
2a7cb20745
2 changed files with 4 additions and 3 deletions
|
|
@ -82,7 +82,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date parseMWDate(String mwDate) {
|
public static Date parseMWDate(String mwDate) {
|
||||||
SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); // Assuming MW always gives me UTC
|
SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); // Assuming MW always gives me UTC
|
||||||
try {
|
try {
|
||||||
return isoFormat.parse(mwDate);
|
return isoFormat.parse(mwDate);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
|
|
@ -91,7 +91,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toMWDate(Date date) {
|
public static String toMWDate(Date date) {
|
||||||
SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); // Assuming MW always gives me UTC
|
SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); // Assuming MW always gives me UTC
|
||||||
isoFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
isoFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
return isoFormat.format(date);
|
return isoFormat.format(date);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import android.text.TextUtils;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import fr.free.nrw.commons.CommonsApplication;
|
import fr.free.nrw.commons.CommonsApplication;
|
||||||
import fr.free.nrw.commons.EventLog;
|
import fr.free.nrw.commons.EventLog;
|
||||||
|
|
@ -131,7 +132,7 @@ public class Contribution extends Media {
|
||||||
|
|
||||||
public String getPageContents() {
|
public String getPageContents() {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||||
|
|
||||||
buffer
|
buffer
|
||||||
.append("== {{int:filedesc}} ==\n")
|
.append("== {{int:filedesc}} ==\n")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue