capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

bug: Changing timeZone doesn't reschedule existing notifications

Open wal0x opened this issue 5 years ago • 1 comments

Bug Report

Capacitor Version

Capacitor Doctor

Latest Dependencies:

  @capacitor/cli: 2.4.3
  @capacitor/core: 2.4.3
  @capacitor/android: 2.4.3
  @capacitor/electron: 2.4.3
  @capacitor/ios: 2.4.3

Installed Dependencies:

  @capacitor/ios not installed
  @capacitor/cli 2.4.2
  @capacitor/android 2.4.2
  @capacitor/core 2.4.2
  @capacitor/electron not installed

[success] Android looking great! �

Platform(s)

Android

Current Behavior

When I schedule a local notification at a specific time, let's say 23h00, while the phone is on 17h59 UTC, and I change the timeZone manually to UTC+4 so the phone's time become 22h59. The local notification does not trigger when the phone arrive to 23h00 on the new timezone.

Expected Behavior

Local notification should be triggered at the new 23h00

Code Reproduction

const notifications: LocalNotification[] = [];
const notificationTime = new Date("2020-11-23T23:00:00.000Z");
notifications.push({
      title, body, id, schedule: {
        on: {
          hour: notificationTime.getHours(),
          minute: notificationTime.getMinutes()
        }
      }
    });
LocalNotifications.schedule({ notifications });

Other Technical Details

npm --version output: 6.14.8

node --version output: v12.19.0

pod --version output (iOS issues only):

Additional Context

At first I was using LocalNotificationSchedule.at like :

notifications.push({
  title, body, id, schedule: { at: new Date(notificationTime) }
});

and I thought that the problem is due to the fact that I pass a Javascript Date object containing already a Timezone. So I switched to use LocalNotificationSchedule.on as above.

wal0x avatar Nov 27 '20 19:11 wal0x

Is there any update or a workaround for this? I'm running into the same issue on iOS.

roelofsaj avatar Sep 15 '22 17:09 roelofsaj

closing due to the lack of sample app reproducing the issue if the issue is still present, please, report it on https://github.com/ionic-team/capacitor-plugins/issues and provide a sample app

jcesarmobile avatar Feb 01 '24 18:02 jcesarmobile

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Mar 02 '24 19:03 ionitron-bot[bot]