what-the-bank/sources/o/cXG.java

291 lines
11 KiB
Java

package o;
import android.content.res.Resources;
import java.text.FieldPosition;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import org.threeten.bp.OffsetDateTime;
/* loaded from: classes4.dex */
public final class cXG {
public static String VL_(Resources resources, String str, OffsetDateTime offsetDateTime) {
if (offsetDateTime == null) {
return null;
}
return offsetDateTime.format(C15554gto.ofPattern(str).withZone(AbstractC15502gsH.of("Asia/Bangkok")).withLocale(bBI.qs_(resources.getConfiguration()).c(0)).withChronology(bBI.qs_(resources.getConfiguration()).c(0).equals(new Locale("th")) ? C15549gtj.INSTANCE : null));
}
public static Date a(OffsetDateTime offsetDateTime) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
StringBuilder sb = new StringBuilder();
sb.append(offsetDateTime.getYear());
sb.append("-");
sb.append(offsetDateTime.getMonthValue());
sb.append("-");
sb.append(offsetDateTime.getDayOfMonth());
return simpleDateFormat.parse(sb.toString());
} catch (ParseException unused) {
guQ.a("Date is null", new Object[0]);
return null;
}
}
public static String a(String str) {
Date date;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
try {
date = simpleDateFormat.parse(str);
} catch (ParseException unused) {
guQ.a("Date is null", new Object[0]);
date = null;
}
return date != null ? simpleDateFormat2.format(date).concat(".000+07:00") : "";
}
/* JADX WARN: Removed duplicated region for block: B:11:0x003b */
/* JADX WARN: Removed duplicated region for block: B:17:0x0048 A[ORIG_RETURN, RETURN] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static java.lang.String c(java.lang.String r4, java.lang.String r5, java.lang.String r6, boolean r7) {
/*
java.text.SimpleDateFormat r0 = new java.text.SimpleDateFormat
r0.<init>(r5)
java.text.SimpleDateFormat r5 = new java.text.SimpleDateFormat
r5.<init>(r6)
java.util.Date r4 = r0.parse(r4) // Catch: java.text.ParseException -> L30
java.util.Calendar r6 = java.util.Calendar.getInstance() // Catch: java.text.ParseException -> L31
r0 = 1
int r6 = r6.get(r0) // Catch: java.text.ParseException -> L31
java.util.Calendar r1 = java.util.Calendar.getInstance() // Catch: java.text.ParseException -> L31
r1.setTime(r4) // Catch: java.text.ParseException -> L31
int r2 = r1.get(r0) // Catch: java.text.ParseException -> L31
int r3 = r2 + (-443)
if (r3 < r6) goto L39
int r2 = r2 + (-543)
r1.set(r0, r2) // Catch: java.text.ParseException -> L31
java.util.Date r4 = r1.getTime() // Catch: java.text.ParseException -> L31
goto L39
L30:
r4 = 0
L31:
r6 = 0
java.lang.Object[] r6 = new java.lang.Object[r6]
java.lang.String r0 = "Date is null"
o.guQ.a(r0, r6)
L39:
if (r4 == 0) goto L48
java.lang.String r4 = r5.format(r4)
if (r7 == 0) goto L4a
java.lang.String r5 = ".000+07:00"
java.lang.String r4 = r4.concat(r5)
goto L4a
L48:
java.lang.String r4 = ""
L4a:
return r4
*/
throw new UnsupportedOperationException("Method not decompiled: o.cXG.c(java.lang.String, java.lang.String, java.lang.String, boolean):java.lang.String");
}
public static Date c(String str, String str2, Boolean bool) {
Date date;
Calendar calendar = Calendar.getInstance();
try {
date = new SimpleDateFormat(str2).parse(str);
if (date == null) {
return date;
}
try {
if (!bool.booleanValue()) {
return date;
}
calendar.setTime(date);
calendar.set(1, calendar.get(1) + 543);
return calendar.getTime();
} catch (ParseException unused) {
guQ.a("Date is null", new Object[0]);
return date;
}
} catch (ParseException unused2) {
date = null;
}
}
public static String b(Date date, String str, Boolean bool) {
SimpleDateFormat simpleDateFormat;
if (bool.equals(Boolean.TRUE)) {
simpleDateFormat = new SimpleDateFormat(str, new Locale("th"));
} else {
simpleDateFormat = new SimpleDateFormat(str, new Locale("en"));
}
return simpleDateFormat.format(date);
}
public static String VK_(Resources resources, String str) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(simpleDateFormat.parse(str));
} catch (ParseException unused) {
guQ.a("Date is null", new Object[0]);
}
return VL_(resources, "dd MMM yyyy", OffsetDateTime.ofInstant(C15517gsm.toInstant(calendar), AbstractC15502gsH.of("Asia/Bangkok")));
}
/* renamed from: o.cXG$5, reason: invalid class name */
/* loaded from: classes4.dex */
public class AnonymousClass5 extends SimpleDateFormat {
public AnonymousClass5(String str) {
super(str);
}
@Override // java.text.SimpleDateFormat, java.text.DateFormat
public final StringBuffer format(Date date, StringBuffer stringBuffer, FieldPosition fieldPosition) {
return super.format(date, stringBuffer, fieldPosition).insert(r1.length() - 2, ":");
}
@Override // java.text.DateFormat, java.text.Format
public final Object parseObject(String str, ParsePosition parsePosition) {
if (str.length() > 3) {
StringBuilder sb = new StringBuilder();
sb.append(str.substring(0, str.length() - 3));
sb.append(str.substring(str.length() - 2));
str = sb.toString();
}
return super.parse(str, parsePosition);
}
}
public static Boolean c(String str, String str2) {
Date date;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str2);
try {
simpleDateFormat.setLenient(false);
date = simpleDateFormat.parse(str);
} catch (ParseException unused) {
guQ.a("Date is null", new Object[0]);
date = null;
}
return Boolean.valueOf(date != null);
}
public static Date b(String str, String str2) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str2);
try {
simpleDateFormat.setLenient(false);
return simpleDateFormat.parse(str);
} catch (IllegalArgumentException unused) {
guQ.a("Illegal argument when parsing Date", new Object[0]);
return null;
} catch (ParseException unused2) {
guQ.a("Date is null", new Object[0]);
return null;
}
}
public static OffsetDateTime d(String str, String str2) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str);
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(simpleDateFormat.parse(str2));
} catch (ParseException e) {
guQ.e(e);
guQ.a("Date is null", new Object[0]);
}
return OffsetDateTime.ofInstant(C15517gsm.toInstant(calendar), AbstractC15502gsH.of("Asia/Bangkok"));
}
public static OffsetDateTime a(String str, String str2) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str);
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(simpleDateFormat.parse(str2));
} catch (ParseException e) {
guQ.e(e);
guQ.a("Date is null", new Object[0]);
}
return OffsetDateTime.ofInstant(C15517gsm.toInstant(calendar), AbstractC15502gsH.of(TimeZone.getDefault().getID()));
}
public static OffsetDateTime d(OffsetDateTime offsetDateTime) {
return offsetDateTime.getYear() + (-443) >= OffsetDateTime.now(AbstractC15502gsH.of("UTC")).getYear() ? offsetDateTime.withYear(offsetDateTime.getYear() - 543) : offsetDateTime;
}
public static String b(String str) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
try {
return new SimpleDateFormat("yyyy-MM-dd").format(simpleDateFormat.parse(str));
} catch (ParseException e) {
guQ.e(e);
return "";
}
}
public static String c(String str) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
return new SimpleDateFormat("dd/MM/yyyy").format(simpleDateFormat.parse(str));
} catch (ParseException e) {
guQ.e(e);
return "";
}
}
public static String e(String str, String str2) {
if (str == null) {
return "";
}
String[] split = str.split(str2);
if (split.length != 3) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append(split[0]);
sb.append(str2);
sb.append(split[1]);
sb.append(str2);
int parseInt = Integer.parseInt(split[2]);
if (parseInt - 443 >= Calendar.getInstance().get(1)) {
parseInt -= 543;
}
sb.append(parseInt);
return sb.toString();
}
public static OffsetDateTime b(String str, String str2, Boolean bool) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str);
Calendar calendar = Calendar.getInstance();
try {
simpleDateFormat.setLenient(bool.booleanValue());
calendar.setTime(simpleDateFormat.parse(str2));
return OffsetDateTime.ofInstant(C15517gsm.toInstant(calendar), AbstractC15502gsH.of("Asia/Bangkok"));
} catch (ParseException e) {
guQ.e(e);
guQ.a("Date is null", new Object[0]);
return null;
}
}
public static String j(String str, String str2) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str);
try {
simpleDateFormat.setLenient(false);
Date parse = simpleDateFormat.parse(str2);
Calendar.getInstance().setTime(parse);
return simpleDateFormat.format(parse);
} catch (ParseException e) {
guQ.a(e.getMessage(), new Object[0]);
return "";
}
}
}