@akadenia/helpers
Version:
Akadenia helpers
46 lines (45 loc) • 1.89 kB
TypeScript
/**
*
* @function
* @param {Date} datetime - The datetime that needs to be formatted.
* @returns {string} - A string representing the datetime in the format "yyyy-mm-dd hh:mm:ss"
*/
export declare const getReadableDateTime: (datetime?: Date) => string;
/**
*
* @function
* @param {Date} datetime - The datetime that needs to be formatted.
* @returns {string} - A string representing the date in the format "yyyy-mm-dd"
*/
export declare const getReadableDate: (datetime?: Date) => string;
/**
*
* @function
* @param {string | Date} date - The date string that needs to be formatted
* @returns {string} - A string representing the date in the user's local timezone
*/
export declare const getDateString: (date: string | Date) => string;
/**
*
* @function
* @param {string | Date} date - The date string that needs to be formatted
* @param {Intl.DateTimeFormatOptions} options - The javascript date formatting options to be used
* @param {string | Intl.Locales | undefined} localTimezone - The local timezone to be used
* @returns {string} - A string representing the date in the user's local timezone
*/
export declare const formatDateTime: (date: string | Date, options: Intl.DateTimeFormatOptions, localTimezone?: string | Intl.Locale) => string;
/**
*
* @function
* @param {string | Date} date - The date string that needs to be returned as a Date object.
* @returns {Date} - A date representing the new date object.
*/
export declare function parseDate(date: string | Date): Date;
/**
*
* @function
* @param {string | Date} date - The date string that needs to be formatted
* @param {boolean} appendTime - A boolean to determine if the time should be appended to the date
* @returns {string} - A string representing the date in the short ordinal date
*/
export declare function getShortOrdinalDate(date: string | Date, appendTime?: boolean): string;