fix: make opts parameter optional in parseActiveHoursTime
The function signature had an optional raw parameter followed by a required opts parameter, which violates TypeScript rules. Since opts is always provided together with raw in actual usage, make it optional. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b5fd66c92d
commit
3bb4d4bf82
@ -89,14 +89,14 @@ function resolveActiveHoursTimezone(cfg: ClawdbotConfig, raw?: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
function parseActiveHoursTime(raw?: string, opts: { allow24: boolean }): number | null {
|
||||
function parseActiveHoursTime(raw?: string, opts?: { allow24: boolean }): number | null {
|
||||
if (!raw || !ACTIVE_HOURS_TIME_PATTERN.test(raw)) return null;
|
||||
const [hourStr, minuteStr] = raw.split(":");
|
||||
const hour = Number(hourStr);
|
||||
const minute = Number(minuteStr);
|
||||
if (!Number.isFinite(hour) || !Number.isFinite(minute)) return null;
|
||||
if (hour === 24) {
|
||||
if (!opts.allow24 || minute !== 0) return null;
|
||||
if (!(opts?.allow24 ?? false) || minute !== 0) return null;
|
||||
return 24 * 60;
|
||||
}
|
||||
return hour * 60 + minute;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user