react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Device in 12h time format, notification scheduled time shows as invalid date

Open branislavantic87 opened this issue 4 years ago • 6 comments

I pass timestamp to schedule local notification and repeat type is daily. This works when device is in 24 time format but when its in 12h time format notification object look like this

 { 
soundName: null,
    id: '165723694',
    date: Invalid Date,
    number: 1,
    message: "Some message",
    title: "Some title"
}

It fires today but for next day does not trigger notification.

branislavantic87 avatar May 17 '21 08:05 branislavantic87

Hi @branislavantic87 If you provide an Invalid Date, it's not a valid date, so how do you expect it to work ? Provide a full reproducible exemple if I do not understand but a valid date is required... Regards

Dallas62 avatar May 17 '21 08:05 Dallas62

Hello @Dallas62 As I said I pass unix timestamp which is valid when phone is in 24 time format, and somehow not valid when device is in 12h time format. Date is valid I assure you, it would work when device is in 24 time format.

branislavantic87 avatar May 17 '21 09:05 branislavantic87

The library expects a JS Date Object, not a timestamp

Dallas62 avatar May 17 '21 09:05 Dallas62

Ok will try that

branislavantic87 avatar May 17 '21 09:05 branislavantic87

@Dallas62 I've done some research and I need to update you. Method getScheduledLocalNotifications() takes notif.date property, line 541 date: (notif.date ? new Date(notif.date) : null). So when phone is in 12h time format which is returned from push-notification-ios formatted like this '2021-05-21T1:55:00.000+02:00', Invalid Date is returned from parsing to js date object. Do you have any idea how could this be bypassed/solved?

branislavantic87 avatar May 21 '21 12:05 branislavantic87

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 22 '22 00:05 github-actions[bot]