Commit 24f07c1
committed
Fix jump-to-date being off by one day in non-UTC timezones
MaterialDatePicker reports the selected day, the calendar constraints, and
the validator callbacks in terms of UTC midnight. When reading those values
back, both JumpToDateValidator.normalizeToLocalMidnight() and the date
picker's positive-button handler converted the UTC-midnight instant using
the local zone:
Instant.ofEpochMilli(timestamp).atZone(ZoneId.systemDefault()).toLocalDate()
For any negative UTC offset, the UTC-midnight instant of calendar day D
falls on the previous evening locally, so toLocalDate() yields D-1. As a
result a message sent on local day D became selectable under picker day
D+1 (the reported "selectable dates are one day ahead" symptom), and the
positive-button handler shifted the jump target by a day as well.
Read the calendar day in UTC (matching how MaterialDatePicker emits it),
then re-anchor to local midnight, which is how message days are keyed in
the database (messageExistsOnDays). Add a regression test exercising a
negative-offset zone (America/New_York); it fails before this change and
passes after.1 parent ec02d80 commit 24f07c1
3 files changed
Lines changed: 29 additions & 2 deletions
File tree
- app/src
- main/java/org/thoughtcrime/securesms/conversation/v2
- test/java/org/thoughtcrime/securesms/conversation/v2
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| 393 | + | |
393 | 394 | | |
394 | 395 | | |
395 | 396 | | |
| |||
5247 | 5248 | | |
5248 | 5249 | | |
5249 | 5250 | | |
5250 | | - | |
| 5251 | + | |
5251 | 5252 | | |
5252 | 5253 | | |
5253 | 5254 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | | - | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
190 | 215 | | |
0 commit comments