UNPKG

atomic-fns

Version:

Like Lodash, but for ESNext and with types. Stop shipping code built for browsers from 2015.

27 lines (26 loc) 1.31 kB
/** * Returns a new Date from the given arguments. * @param {string | number | Date} date The date value * @param {?boolean} [utc=false] Interprets the given value as a UTC date * @returns {Date} The new date object */ export declare function asDate(date: string | number | Date, utc?: boolean): Date; /** * Returns a localized string representation of this date, according to the given format string. Format codes use the same specification as {@link https://momentjs.com/docs/#/displaying/format/ moment}. * @param {string} str The format string to use * @see {@link https://momentjs.com/docs/#/displaying/format/ List of formats} * @example ```js formatDate(new Date(), 'MM/DD/YYYY') // '10/31/2022' ``` */ export declare function formatDate(formatStr: string, date: Date, locale?: string): string; /** * Formats a date using a formatting string in the {@link https://strftime.org/ strftime} format, in any given locale. * @param {string} fmt The format string to apply * @param {Date} date The date value * @param {?string} locale The locale to use when formatting (default is system locale). * @returns {string} The string representation of date * @see {@link https://strftime.org/ strftime format} */ export declare function strftime(fmt: string, date: Date, locale?: string): string;