I'm writing a notifications scheduling function and want to limit how frequently I send a user notifications, so need some Date math (e.g., nowDate > lastSend + 1 day). I'm finding JS support for Date math in posts here and here but am getting errors when trying to apply them. E.g., below attempts to add 100 minutes to user.notificationTimestamp
let whenOkayToSend: Date = user.notificationTimestamp
whenOkayToSend = whenOkayToSend + 100*60*1000
Give error
Operator '+' cannot be applied to types 'Date' and 'number'.
When I tried getMinutes
and setMinutes
the errors say no such functions. How do I add minutes to a Date object in cloud functions?