@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
60 lines (59 loc) • 1.72 kB
TypeScript
/**
* --------------------------------------------
* Date formats
* --------------------------------------------
*/
export declare const UI_INPUT_FORMATS: readonly ["D/M/YYYY", "DD/MM/YYYY"];
/**
* --------------------------------------------
* Validation helpers
* --------------------------------------------
*/
export declare function isValidUiDate(value?: string): boolean;
/**
* --------------------------------------------
* Transform helpers
* --------------------------------------------
*/
/**
* DD/MM/YYYY -> YYYY-MM-DD
*
* @export
* @param {string} [value]
* @return {*} {(string | undefined)}
*/
export declare function uiDateToApi(value?: string): string | undefined;
/**
* YYYY-MM-DD -> DD/MM/YYYY
*
* @export
* @param {string} [value]
* @return {*} {(string | undefined)}
*/
export declare function apiDateToUi(value?: string): string | undefined;
/**
* TS -> DD/MM/YYYY
*
* @export
* @param {(string | Date)} [value]
* @return {*} {(string | undefined)}
*/
export declare function apiTimestampToUiDate(value?: string | Date): string | undefined;
/**
* TS -> DD/MM/YYYY HH:mm
*
* @export
* @param {(string | Date)} [value]
* @return {*} {(string | undefined)}
*/
export declare function apiTimestampToUiDateTime(value?: string | Date): string | undefined;
/**
* --------------------------------------------
* Display helpers
* --------------------------------------------
*/
export declare function formatDateOrUnset(value?: string): string;
export declare function todayAsApiDate(): string;
export declare function todayAsUiDate(): string;
export declare function todayAsUiDateTime(): string;
export declare function toDate(value: unknown): Date | undefined;