Skip to content

Commit

Permalink
clearInterval on store
Browse files Browse the repository at this point in the history
  • Loading branch information
ticruz38 committed Nov 6, 2024
1 parent 3f8355b commit 0161b81
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import Fuse from "fuse.js"
import logger from "src/util/logger"

export const timestamp1: Readable<number> = derived([], (_, set) => {
setInterval(() => {
const interval = setInterval(() => {
set(Math.floor(Date.now() / 1000))
}, 1000)
return () => clearInterval(interval)
})

export const secondsToDate = ts => new Date(parseInt(ts) * 1000)
Expand Down

0 comments on commit 0161b81

Please sign in to comment.