@worktif/purei
Version:
Work TIF Material UI Theme Provider and Customization Suite for React applications with dark mode support and dynamic color schemes
25 lines (24 loc) • 1.27 kB
TypeScript
import { Maybe } from '../types';
/**
* Represents options for formatting or displaying localized date values.
*
* @typedef {Object} LocaleDateOptions
* @property {Maybe<boolean>} [hasDay] Specifies whether the day of the month should be included.
* @property {Maybe<boolean>} [hasWeekday] Specifies whether the weekday should be included.
* @property {Maybe<string>} [presentText] Specifies a custom text to represent the current date.
*/
type LocaleDateOptions = {
hasDay?: Maybe<boolean>;
hasWeekday?: Maybe<boolean>;
presentText?: Maybe<string>;
};
/**
* Formats a given date into a localized string based on specified locale and options.
*
* @param {Maybe<Date>} date - The date object to be formatted. If `undefined`, the method returns a placeholder string.
* @param {Maybe<LocaleDateOptions>} [options] - Optional formatting options. Defines whether to include weekday or day in the date string.
* @param {string} [locale=navigator.language] - The locale used for formatting. Defaults to the user's browser language or a default locale if unavailable.
* @return {string} The formatted localized date string.
*/
export declare function localeDate(date: Maybe<Date>, options?: Maybe<LocaleDateOptions>, locale?: string): string;
export {};