時報休止期間を修正・package.jsonの情報を修正・v4.2
This commit is contained in:
+11
-7
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user