CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-cron

Cron jobs for Node.js applications that enables developers to execute functions or system commands on schedules defined using standard cron syntax

94

1.20x
Overview
Eval results
Files

task.mdevals/scenario-9/

Reminder Scheduler

Build a reminder scheduler that executes one-time reminders at specific dates and times.

Requirements

Your task is to implement a reminder scheduler that allows users to schedule reminders to fire at exact dates and times in the future. Each reminder should execute exactly once at the scheduled time.

The scheduler should:

  • Accept a specific date/time when the reminder should fire
  • Execute a callback function at the scheduled time
  • Support both immediate start and delayed start of scheduling
  • Handle reminders scheduled for various future times (minutes, hours, or days ahead)

Implementation

@generates

API

/**
 * Schedules a one-time reminder to execute at a specific date/time.
 *
 * @param {Date} reminderTime - The exact date and time when the reminder should fire
 * @param {Function} onReminder - Callback function to execute when the reminder fires
 * @param {boolean} [autoStart=true] - Whether to start the scheduler immediately
 * @returns {Object} A scheduler object with start() and stop() methods
 */
function scheduleReminder(reminderTime, onReminder, autoStart = true) {
  // IMPLEMENTATION HERE
}

module.exports = { scheduleReminder };

Test Cases

Basic Scheduling

  • Scheduling a reminder 100ms in the future executes the callback after approximately 100ms @test
  • Scheduling a reminder 500ms in the future executes the callback within 550ms @test

Manual Start Control

  • When autoStart is false, the reminder does not execute until start() is called @test

Stopping Reminders

  • Calling stop() before the scheduled time prevents the reminder from executing @test

Dependencies { .dependencies }

cron { .dependency }

Job scheduling library for Node.js that supports Date-based one-time execution.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-cron

tile.json