threetenbp: Date formatting fails on some Android devices
I haven’t been able to reproduce this myself, but I am getting reports from the wild that sometimes LocalDate.format()
is returning an invalid result on some Android devices. (Using https://github.com/JakeWharton/ThreeTenABP.)
Here’s what happens, as confirmed by the log call in this method.
- On entry to this method,
month
is2016-08
. startOfMonth
is correctly set to2016-08-01
.monthString
gets set to0000-00-00
which is wrong.
private Observable<Void> ensureDataForMonthExistsInternal(YearMonth month) {
final LocalDate startOfMonth = month.atDay(1);
final String monthString = startOfMonth.format(DateTimeFormatter.ISO_LOCAL_DATE);
Timber.i("Calling ensureDataForMonthExists with month %s, as date %s, formatted %s", month, startOfMonth, monthString);
So far the issue seems to affect only Motorola devices running Android 6.0.
Does threetenbp actually use possibly-broken system APIs for date formatting? Or is it completely self-contained? Intuitively, my expectation is that using DateTimeFormatter.ISO_LOCAL_DATE
should not require the locale or any other information to be read from the system.
This was originally reported as https://github.com/JakeWharton/ThreeTenABP/issues/33.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (7 by maintainers)
That workaround is safe, the toString format will not change