@ecomplus/utils
Version:
JS utility functions to E-Com Plus (not only) related apps
22 lines • 828 B
TypeScript
export default formatDate;
/**
* @method
* @memberof ecomUtils
* @name formatDate
* @description Parse date to locale formatted string.
* @param {string|Object.<string, *>} date - Date object or ISO string, or body object (order, product...)
* @param {string} [lang=$ecomConfig.get('lang')] - Snake case language code, eg.: 'en_us', 'pt_br'
* @param {Object.<string, *>} [options] - Options object for `toLocaleDateString` function
* @returns {string}
*
* @example
* const notification = { datetime: '2019-06-19T03:35:52.811Z', content: {api_event: {resource: 'orders'}}}
* ecomUtils.formatDate(notification, 'pt-br')
* // => "19/06/2019"
*/
declare function formatDate(date: string | {
[x: string]: any;
}, lang?: string, options?: {
[x: string]: any;
}): string;
//# sourceMappingURL=format-date.d.ts.map