@rashedmakkouk/dev-utils
Version:
Utility library.
17 lines (16 loc) • 516 B
TypeScript
/** Typings */
import { TimestampOptions } from '../types';
/**
* Parses any date value to a timestamp with predefined or custom format.
*
* - datetime: dddd, MMMM D at h:mA
* - fromNow: Relative time.
* - short: ddd, MMM D
* - sql: YYYY-MM-DD HH:mm:ss
*
* @param date - Parses supplied value, else falls back to Date/Time Now.
*
* @returns Formatted timestamp.
*/
declare function timestamp(date?: string | number | Date | null | undefined, options?: TimestampOptions): string;
export default timestamp;