Skip to content

Commit

Permalink
fix: Timer starts from 0
Browse files Browse the repository at this point in the history
  • Loading branch information
th0mas committed Mar 12, 2024
1 parent 42f2aee commit b9ed35d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/app_web/live/app_live.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,13 @@
class="flex flex-col"
x-data="{
start: $refs.timer_start ? $refs.timer_start.innerHTML : null,
current: null,
current: Date.now(),
stop: null,
interval: null
}"
x-init="
start = $refs.timer_start.innerHTML;
current = start;
current = Date.now();
interval = setInterval(() => { current = Date.now(), start = $refs.timer_start ? $refs.timer_start.innerHTML : null }, 500)
"
>
Expand Down Expand Up @@ -524,7 +524,6 @@
x-text="timer_text(start, current || stop)"
class="text-sm font-mono font-semibold text-right mr-1"
>
00:00:00
</span>
</p>
</div>
Expand Down

0 comments on commit b9ed35d

Please sign in to comment.