Skip to content

Commit

Permalink
日本時間計算になるようにする
Browse files Browse the repository at this point in the history
  • Loading branch information
yamanoku committed Apr 16, 2024
1 parent 8f44d41 commit 9f78d5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/islands/counter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export default function Counter(props: InitialTime) {
(Number(nextBirthday) - Number(now)) / 1000
);
const days = Math.floor(diffInSeconds / (60 * 60 * 24));
// hoursを日本時間の24時間計算になるようにする
const hours = Math.floor((diffInSeconds / (60 * 60)) % 24) - 9;
hours < 0 ? hours + 24 : hours;
const minutes = Math.floor((diffInSeconds / 60) % 60);
const seconds = diffInSeconds % 60;

Expand Down
2 changes: 2 additions & 0 deletions app/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default function Index() {

const diffInSeconds = Math.floor((Number(nextBirthday) - Number(now)) / 1000);
const days = Math.floor(diffInSeconds / (60 * 60 * 24));
// hoursを日本時間の24時間計算になるようにする
const hours = Math.floor((diffInSeconds / (60 * 60)) % 24) - 9;
hours < 0 ? hours + 24 : hours;
const minutes = Math.floor((diffInSeconds / 60) % 60);
const seconds = diffInSeconds % 60;

Expand Down

0 comments on commit 9f78d5b

Please sign in to comment.