getMonthName
The `getMonthName` function retrieves the name of the month (e.g., `Jan`, `January`) from a given date. If no date is provided, it defaults to the current date.> getMonthName(date?: Date | FixedDate | null, format?: "short" | "long"): string
- date: Optional date to extract the month from, defaults to the current date. Accepts a Date object, a string in `YYYY-MM-DD` format, or null.
- Returns: The name of the month in the specified format.
Example
import { getMonthName } from "@explita/daily-toolset";
// Default: current date and short format
getMonthName(); // "Nov" (if today's month is November)
// Specified date with long format
getMonthName(new Date("2024-11-04"), "long"); // "November"
// Using a fixed date string with short format
getMonthName("2024-11-04", "short"); // "Nov"