fix(heartbeat): return false for zero-width active-hours window (#21408)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 993860bd03
Co-authored-by: adhitShet <131381638+adhitShet@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
adhitShet
2026-02-20 05:03:57 +04:00
committed by GitHub
parent 57f0ac21e9
commit ae4907ce6e
4 changed files with 16 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ describe("isWithinActiveHours", () => {
).toBe(true);
});
it("returns true when activeHours start equals end", () => {
it("returns false when activeHours start equals end", () => {
const cfg = cfgWithUserTimezone("UTC");
expect(
isWithinActiveHours(
@@ -47,7 +47,7 @@ describe("isWithinActiveHours", () => {
heartbeatWindow("08:00", "08:00", "UTC"),
Date.UTC(2025, 0, 1, 12, 0, 0),
),
).toBe(true);
).toBe(false);
});
it("respects user timezone windows for normal ranges", () => {

View File

@@ -83,7 +83,7 @@ export function isWithinActiveHours(
return true;
}
if (startMin === endMin) {
return true;
return false;
}
const timeZone = resolveActiveHoursTimezone(cfg, active.timezone);