Skip to content

Commit

Permalink
fix: 🐛 Timer off by UHC - timezone offset hours
Browse files Browse the repository at this point in the history
Closes MikhaD#31
  • Loading branch information
MikhaD committed Feb 24, 2022
1 parent 5a3a7b2 commit b71007a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "wordle+",
"description": "A remake of the popular game Wordle with additional modes and features.",
"version": "1.2.1",
"version": "1.2.2",
"private": "true",
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"start": "sirv public --no-clear --host 0.0.0.0",
"start": "sirv public --no-clear --host",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion public/sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! IF ANYTHING IN THIS FILE IS CHANGED MAKE SURE setVersion.js HAS ALSO BEEN UPDATED
// Increase the v number when the app is updated
const cacheName = "wordle+-v1.2.1";
const cacheName = "wordle+-v1.2.2";

const assetsToCache = [
"./",
Expand Down
10 changes: 8 additions & 2 deletions src/components/widgets/Timer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
export function reset(m: GameMode) {
clearInterval(countDown);
ms = modeData.modes[m].unit - (new Date().valueOf() - modeData.modes[m].seed);
ms =
modeData.modes[m].unit -
(new Date().valueOf() - modeData.modes[m].seed) +
new Date().getTimezoneOffset() * 60000;
if (ms < 0) dispatch("timeup");
countDown = setInterval(() => {
ms = modeData.modes[m].unit - (new Date().valueOf() - modeData.modes[m].seed);
ms =
modeData.modes[m].unit -
(new Date().valueOf() - modeData.modes[m].seed) +
new Date().getTimezoneOffset() * 60000;
if (ms < 0) {
clearInterval(countDown);
dispatch("timeup");
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import App from "./App.svelte";
export default new App({
target: document.body,
props: {
version: "1.2.1",
version: "1.2.2",
}
});

0 comments on commit b71007a

Please sign in to comment.