fix(#7): use UTC for DateField initial seed to match pick conversion
DateField seeded the picker with ZoneId.systemDefault() but converted
the selectedDateMillis back with ZoneId.of("UTC"). For any non-UTC
user, the field and the picker displayed different days, and
confirming without re-picking silently shifted the export range by a
day. Use UTC on both sides (the DatePickerState contract is that
selectedDateMillis is UTC midnight of the picked day).
This commit is contained in:
@@ -185,7 +185,7 @@ private fun DateField(
|
||||
)
|
||||
|
||||
if (showPicker) {
|
||||
val initialMillis = date.atStartOfDay(ZoneId.systemDefault())
|
||||
val initialMillis = date.atStartOfDay(ZoneId.of("UTC"))
|
||||
.toInstant()
|
||||
.toEpochMilli()
|
||||
val datePickerState = rememberDatePickerState(initialSelectedDateMillis = initialMillis)
|
||||
|
||||
Reference in New Issue
Block a user