File: /var/www/html/wpmuhibbah_err/wp-content/plugins/give/src/Views/Components/AdminDetailsPage/utils.ts
/**
* @since 4.4.0
*/
export function amountFormatter(currency: Intl.NumberFormatOptions['currency'], options?: Intl.NumberFormatOptions): Intl.NumberFormat {
return new Intl.NumberFormat(navigator.language, {
style: 'currency',
currency: currency,
...options
});
}
/**
* @since 4.6.0
*/
export function formatDateTimeLocal(dateString: string) {
if (!dateString) return '';
const date = new Date(dateString);
if (isNaN(date.getTime())) return '';
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
return `${year}-${month}-${day}T${hours}:${minutes}:00`;
}