diff --git a/app/islands/counter.tsx b/app/islands/counter.tsx index 41f80273..ce7f5799 100644 --- a/app/islands/counter.tsx +++ b/app/islands/counter.tsx @@ -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; diff --git a/app/routes/index.tsx b/app/routes/index.tsx index 842a4165..d716a014 100644 --- a/app/routes/index.tsx +++ b/app/routes/index.tsx @@ -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;