停止時間のBooleanを使いまわしている問題を修正(v4.3.3)

This commit is contained in:
2025-07-06 08:53:02 +09:00
parent ef374b1639
commit 05194ad7b8
2 changed files with 18 additions and 20 deletions
+17 -19
View File
@@ -3,28 +3,26 @@ import { format } from "date-fns";
import type * as types from "types/types";
import config from "../config.js";
// 停止時間
// 時刻取得
const start = config.time.stopTimes.start;
const stop = config.time.stopTimes.stop;
// 現在の時間を取得
const nowHour = new Date().getHours();
// 停止時刻内かどうかの判定
let inRange: boolean = false;
if (start < stop) {
inRange = nowHour >= start && nowHour < stop;
} else {
inRange = nowHour >= start || nowHour < stop;
}
export default async function timeNotice() {
console.log("----------------");
// 停止時間
// 時刻取得
const start = config.time.stopTimes.start;
const stop = config.time.stopTimes.stop;
// 現在の時間を取得
const nowHour = new Date().getHours();
// 停止時刻内かどうかの判定
let inRange: boolean = false;
if (start < stop) {
inRange = nowHour >= start && nowHour < stop;
} else {
inRange = nowHour >= start || nowHour < stop;
}
if (inRange) {
console.log("時報休止期間のため投稿されませんでした");
return;