Skip to content

Commit

Permalink
Cast to a number first
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Jun 28, 2023
1 parent bdea997 commit 003cf05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default class Storage {
}

// Expired
if (parseInt(expires) < now) {
const iAmSureThisIsANumber: number = expires as number;
if (iAmSureThisIsANumber < now) {
this.removeStorage(key)
return null
}
Expand Down Expand Up @@ -79,7 +80,7 @@ export default class Storage {
expires = 24 * 60 * 60 // default: seconds for 1 day
}

// Milli seconds since epoch time, lets deal only with integer
// Milliseconds since epoch time, lets deal only with integer
const now = Date.now()
const schedule = now + expires * 1000
try {
Expand Down

0 comments on commit 003cf05

Please sign in to comment.