mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-08 19:27:04 +01:00
Reminders without time use UTC and do so also when changing the date
This commit is contained in:
parent
8a4aca06e6
commit
76fb19a1b9
@ -156,9 +156,9 @@ public class ConfigureReminders extends AbstractGBActivity {
|
||||
if (gbDevice.getDeviceCoordinator().getRemindersHaveTime()) {
|
||||
reminder.setDate(Calendar.getInstance().getTime());
|
||||
} else {
|
||||
Calendar noonGMT = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
noonGMT.set(noonGMT.get(Calendar.YEAR), noonGMT.get(Calendar.MONTH), noonGMT.get(Calendar.DAY_OF_MONTH), 12, 0);
|
||||
reminder.setDate(noonGMT.getTime());
|
||||
Calendar noonUTC = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||
noonUTC.set(noonUTC.get(Calendar.YEAR), noonUTC.get(Calendar.MONTH), noonUTC.get(Calendar.DAY_OF_MONTH), 12, 0);
|
||||
reminder.setDate(noonUTC.getTime());
|
||||
}
|
||||
reminder.setMessage("");
|
||||
reminder.setDeviceId(device.getId());
|
||||
|
@ -41,6 +41,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.TimeZone;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Locale;
|
||||
@ -206,8 +207,16 @@ public class ReminderDetails extends AbstractGBActivity implements TimePickerDia
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) {
|
||||
final Calendar date = new GregorianCalendar(year, month, dayOfMonth);
|
||||
reminder.setDate(new Date(date.getTimeInMillis()));
|
||||
final DeviceCoordinator coordinator = device.getDeviceCoordinator();
|
||||
|
||||
if (coordinator.getRemindersHaveTime()) {
|
||||
final Calendar date = new GregorianCalendar(year, month, dayOfMonth);
|
||||
reminder.setDate(new Date(date.getTimeInMillis()));
|
||||
} else {
|
||||
Calendar noonUTC = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||
noonUTC.set(year, month, dayOfMonth, 12, 0);
|
||||
reminder.setDate(noonUTC.getTime());
|
||||
}
|
||||
updateUiFromReminder();
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ public abstract class Casio2C2DSupport extends CasioSupport {
|
||||
System.arraycopy(message, 0, data[2*pos], 2, Math.min(message.length, 18));
|
||||
Arrays.fill(data[2*pos], 2+message.length, 20, (byte) 0);
|
||||
|
||||
LocalDate start = LocalDate.ofInstant(reminder.getDate().toInstant(), ZoneId.of("GMT"));
|
||||
LocalDate start = LocalDate.ofInstant(reminder.getDate().toInstant(), ZoneId.of("UTC"));
|
||||
if (start.getYear() < 2000) {
|
||||
if (reminder.getRepetition() == Reminder.EVERY_WEEK) {
|
||||
final LocalDate first = LocalDate.of(2000, 1, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user