Skip to content

Commit

Permalink
πŸ› Bad management of countdown widget on different timezones #1635
Browse files Browse the repository at this point in the history
  • Loading branch information
ithiame committed Dec 16, 2024
1 parent 6d2599e commit ec55082
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib/components/CountdownWidget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
let className = '';
export { className as class };
export let countdown: Pick<Countdown, '_id' | 'title' | 'description' | 'endsAt'>;
const timezoneOffsetHours = new Date().getTimezoneOffset() / 60;
let endsAt = addHours(countdown.endsAt, timezoneOffsetHours);
$: distance = differenceInMilliseconds(endsAt, new Date());
let endsAt = countdown.endsAt;
$: distance = differenceInMilliseconds(endsAt.toISOString(), new Date(new Date().toISOString()));
function updateCountdown() {
distance = Math.max(differenceInMilliseconds(endsAt, new Date()), 0);
}
Expand Down

0 comments on commit ec55082

Please sign in to comment.