@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
38 lines (37 loc) • 992 B
TypeScript
import { Nil } from '../misc';
type DateInput = Date | string | number;
/**
* Formats date to include just the day, month and year.
* The exact date format is based on locale.
*
* @example
* // US format
* "2/12/2019"
*
* @example
* // PL format
* "12.02.2019"
*/
export declare const formatDate: (value: DateInput) => string;
/**
* Formats date like `formatDate`, but replaces Nil and empty strings with `null`.
*/
export declare const formatNilDate: (value: Nil<DateInput>) => string | null;
/**
* Formats date to include both day, month, year and hours, seconds.
* The exact date format is based on locale.
*
* @example
* // US format
* "2/12/2019 11:31 PM"
*
* @example
* // PL format
* "12.02.2019 23:31"
*/
export declare const formatDateTime: (value: DateInput) => string;
/**
* Formats date like `formatDateTime`, but replaces Nil and empty strings with `null`.
*/
export declare const formatNilDateTime: (value: Nil<DateInput>) => string | null;
export {};