diff --git a/plugins/notification/ios/Sources/Notification.swift b/plugins/notification/ios/Sources/Notification.swift index a6218c31..3c304020 100644 --- a/plugins/notification/ios/Sources/Notification.swift +++ b/plugins/notification/ios/Sources/Notification.swift @@ -134,8 +134,11 @@ func handleScheduledNotification(_ invoke: Invoke, _ schedule: JSObject) throws let payload = schedule["data"] as? JSObject ?? [:] switch kind { case "At": - let date = payload["at"] as? String ?? "" - let dateFormatter = ISO8601DateFormatter() + let date = payload["date"] as? String ?? "" + let dateFormatter = DateFormatter() + dateFormatter.locale = Locale(identifier: "en_US_POSIX") + dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" + if let at = dateFormatter.date(from: date) { let repeats = payload["repeats"] as? Bool ?? false @@ -157,7 +160,7 @@ func handleScheduledNotification(_ invoke: Invoke, _ schedule: JSObject) throws timeInterval: dateInterval.duration, repeats: repeats) } else { - invoke.reject("could not parse `at` date") + invoke.reject("could not parse `at` date \(date)") } case "Interval": let dateComponents = getDateComponents(payload) diff --git a/plugins/notification/ios/Sources/NotificationPlugin.swift b/plugins/notification/ios/Sources/NotificationPlugin.swift index f71554f3..283d03ce 100644 --- a/plugins/notification/ios/Sources/NotificationPlugin.swift +++ b/plugins/notification/ios/Sources/NotificationPlugin.swift @@ -40,10 +40,6 @@ func showNotification(invoke: Invoke, notification: JSObject) do { if let schedule = notification["schedule"] as? JSObject { try trigger = handleScheduledNotification(invoke, schedule) - } else { - let match = Calendar.current.dateComponents( - [.timeZone, .year, .month, .day, .hour, .minute], from: Date()) - trigger = UNCalendarNotificationTrigger(dateMatching: match, repeats: false) } } catch { throw ShowNotificationError.create(error)