時報休止期間を修正・package.jsonの情報を修正・v4.2

This commit is contained in:
2025-07-05 11:46:43 +09:00
parent 678f4aa1b1
commit c3ab3a8456
4 changed files with 20 additions and 15 deletions
+11 -7
View File
@@ -1,20 +1,24 @@
import { format, isAfter, isBefore } from "date-fns";
import { format } from "date-fns";
import type * as types from "types/types";
import config from "../config.js";
// 停止時間
// 時刻取得
const now = new Date();
const start = config.time.stopTimes.start;
const stop = config.time.stopTimes.stop;
// 停止時刻外
let inRange: Boolean = false;
// 現在の時間を取得
const nowHour = new Date().getHours();
if (isBefore(start, stop)) {
inRange = isAfter(now, start) && isBefore(now, stop);
// 停止時刻内かどうかの判定
let inRange: boolean = false;
if (start < stop) {
inRange = nowHour >= start && nowHour < stop;
} else {
inRange = isAfter(now, start) || isBefore(now, stop);
inRange = nowHour >= start || nowHour < stop;
}