1
mirror of https://github.com/CarmJos/UltraDepository.git synced 2026-06-04 16:48:21 +08:00

[v1.2.2] 版本修复

- [F] 修复 getDateInt() 可能报错的问题。
This commit is contained in:
2022-01-07 00:51:15 +08:00
parent 52df1863f4
commit 988fe600ce
3 changed files with 9 additions and 5 deletions
@@ -117,7 +117,7 @@ public class UserData {
public Date getDate() {
return new Date(DateIntUtil.getDateMillis(getDateInt()));
return DateIntUtil.getDate(getDateInt());
}
public int getDateInt() {
@@ -22,10 +22,14 @@ public class DateIntUtil {
}
public static long getDateMillis(int dateInt) {
return getDate(dateInt).getTime();
}
public static Date getDate(int dateInt) {
try {
return getFormat().parse(Integer.toString(dateInt)).getTime();
} catch (ParseException e) {
return System.currentTimeMillis();
return (Date) getFormat().parse(Integer.toString(dateInt));
} catch (ParseException | NumberFormatException e) {
return new Date(System.currentTimeMillis());
}
}