getDay

The `getDay` function extracts the day of the month (e.g., 01, 15) from a given date. If no date is provided, the current date is used by default.
> getDay(date?: Date | FixedDate | null): number
Parameters
  • date: Optional date to extract the day from, defaults to the current date. Accepts a Date object, a string in `YYYY-MM-DD` format, or null.
  • Returns: A number representing the day of the month

Example

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

// Default: current date
getDay(); // "04" (if today's date is 4th)

// Specified date
getDay(new Date("2024-11-04")); // "04"

// Using a fixed date string
getDay("2024-11-04"); // "04"