@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
18 lines (16 loc) • 484 B
JavaScript
import { todayDate } from "../../internal/todayDate.js";
// src/plain/get/getToday.ts
/**
* Return the current PlainDate as an ISO string in the system timeZone.
*
* - Uses nowZonedDateTimeISO() to get current date in system timezone.
* - Returns "" when system timezone is unavailable.
*
* @returns ISO 8601 PlainDate string or "" on error
*
* @example getToday() // "2024-03-15" (current date)
*/
function getToday() {
return todayDate()?.toString() ?? "";
}
export { getToday };