diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..8eef1430 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +*.disabled \ No newline at end of file diff --git a/src/store/Accounts.ts b/src/store/Accounts.ts index 57f6a47e..e19e926a 100644 --- a/src/store/Accounts.ts +++ b/src/store/Accounts.ts @@ -86,11 +86,15 @@ export class Accounts implements Module { updateCodes(state: AccountsState) { let second = new Date().getSeconds(); if (UserSettings.items.offset) { - // prevent second from negative - second += Number(UserSettings.items.offset) + 60; + second += Number(UserSettings.items.offset); } - second = second % 60; + if (second < 0) { + // Handle the situation where offset causes `second` to be negative. #1310 + second = 60 - ((second * -1) % 60); + } else { + second = second % 60; + } state.second = second; let currentlyEncrypted = false;