Skip to content

Commit

Permalink
Fix active snooze endtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacqary committed Jun 28, 2022
1 parent e586a11 commit 63e5deb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
import { RRule, ByWeekday, Weekday, rrulestr } from 'rrule';
import { RuleSnoozeSchedule } from '../../types';

const MAX_TIMESTAMP = 8640000000000000;

export function isSnoozeActive(snooze: RuleSnoozeSchedule) {
const { duration, rRule, id } = snooze;
if (duration === -1) return true;
if (duration === -1)
return {
id,
snoozeEndTime: new Date(MAX_TIMESTAMP),
};
const startTimeMS = Date.parse(rRule.dtstart);
const initialEndTime = startTimeMS + duration;
// If now is during the first occurrence of the snooze
Expand Down

0 comments on commit 63e5deb

Please sign in to comment.