isTomorrow

A utility function to check if a given date is tomorrow.
> isTomorrow(date: Date): boolean
Parameters
  • date: The date to compare against tomorrow's date.
  • Returns: `true` if the given date matches tomorrow's date, `false` otherwise.

Example

import { isTomorrow } from "@explita/daily-toolset";

/ Check if tomorrow matches the given date
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
console.log(isTomorrow(tomorrow)); // true

// Check with today's date
const today = new Date();
console.log(isTomorrow(today)); // false

// Check with a specific date
const specificDate = new Date("2024-11-23");
console.log(isTomorrow(specificDate)); 
// true or false depending on the current date

Use Cases

  • Scheduling notifications or reminders for events happening tomorrow.
  • Validating if a task's due date is tomorrow.
  • Filtering or highlighting dates for upcoming activities.