From f7dfebcbeacb3db182bdc3b01cf7a1d9cea720ca Mon Sep 17 00:00:00 2001 From: sk Date: Mon, 27 Nov 2023 22:20:12 +0100 Subject: [PATCH] fix schedule date picker not time zone safe closes sk22#940 --- .../org/joinmastodon/android/fragments/ComposeFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index 1962f56870..0764b7d7ae 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -1437,8 +1437,8 @@ private void pickScheduledDateTime() { .withMinute(0); new DatePickerDialog(getActivity(), (datePicker, year, arrayMonth, dayOfMonth) -> { new TimePickerDialog(getActivity(), (timePicker, hour, minute) -> { - updateScheduledAt(LocalDateTime.of(year, arrayMonth + 1, dayOfMonth, hour, minute) - .toInstant(OffsetDateTime.now().getOffset())); + LocalDateTime at=LocalDateTime.of(year, arrayMonth + 1, dayOfMonth, hour, minute); + updateScheduledAt(at.toInstant(ZoneId.systemDefault().getRules().getOffset(at))); }, soon.getHour(), soon.getMinute(), DateFormat.is24HourFormat(getActivity())).show(); }, soon.getYear(), soon.getMonthValue() - 1, soon.getDayOfMonth()).show(); }