ionic-frameworkcapacitorlocalnotification

Difference between "at" and "on" option of schedule in LocalNotification in ionic capacitor


Can anyone please explain to me what is the difference between using "at" and "on", because the purpose I feel similar? Just the writing style of date is different?

export interface LocalNotificationSchedule {
    at?: Date;
    repeats?: boolean;
    every?: 'year' | 'month' | 'two-weeks' | 'week' | 'day' | 'hour' | 'minute' | 'second';
    count?: number;
    on?: {
        year?: number;
        month?: number;
        day?: number;
        hour?: number;
        minute?: number;
    };
}```

Solution

  • 'at' means you have to set the notification on that specific date you have no other option, whereas, with 'on' you can say, i want it on year 2014 or i want it on day 15. You have multiple options with 'on', with 'at', you have only one.

    Meaning, for 'at' on that specific date it will be triggered, but for 'on', once you set it at day = 15, each day 15 of the month it would trigger.