RocketChat / RocketChat/Rocket.Chat
Reminder with reminderMinutesBeforeStart = 0 is ignored due to falsy check
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description
When creating a calendar event with reminderMinutesBeforeStart explicitly set to 0, the reminder is silently ignored. This happens because the reminderTime calculation relies on a truthy check, causing valid numeric values like 0 to be treated as if no reminder was configured.
Current Behavior
If an event is created with:
reminderMinutesBeforeStart: 0
The following logic is executed:
const reminderTime = minutes ? getShiftedTime(startTime, -minutes) : undefined;
Since 0 is a falsy value in JavaScript/TypeScript, reminderTime becomes undefined.
As a result:
reminderMinutesBeforeStartis stored as0reminderTimeis not generated- No notification is scheduled
Expected Behavior
A value of 0 should be treated as a valid input, representing an immediate reminder at the event start time.
For example:
startTime = 10:00
reminderMinutesBeforeStart = 0
Expected:
reminderTime = 10:00
Root Cause
The condition:
minutes ? getShiftedTime(...) : undefined
incorrectly filters out valid values like 0. The logic checks for truthiness instead of checking whether a numeric value was provided.
Proposed Fix
Replace the falsy check with an explicit undefined/type check:
const reminderTime =
minutes !== undefined ? getShiftedTime(startTime, -minutes) : undefined;
This ensures that 0 is handled correctly while preserving existing behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the reminderTime calculation that uses minutes in the calendar event creation flow and trace how its result reaches notification scheduling. Verify that an explicit value of 0 produces a reminderTime equal to startTime, while an omitted value still produces no reminder; add or run the relevant reminder tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100