Skip to content

Commit

Permalink
Fix expiration when 0
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba committed Sep 19, 2024
1 parent 740f5d9 commit a0c4534
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/apns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ export class ApnsClient extends EventEmitter {
options.headers!['apns-priority'] = notification.priority.toString()
}

if (notification.options.expiration) {
const expiration = notification.options.expiration
if (typeof expiration !== 'undefined') {
options.headers!['apns-expiration'] =
typeof notification.options.expiration === 'number'
? notification.options.expiration.toFixed(0)
: (notification.options.expiration.getTime() / 1000).toFixed(0)
typeof expiration === 'number'
? expiration.toFixed(0)
: (expiration.getTime() / 1000).toFixed(0)
}

if (notification.options.collapseId) {
Expand Down

0 comments on commit a0c4534

Please sign in to comment.