ErrorBoundary
1 year ago
Icons
11 months ago
Notifications
11 months ago
Tabs
11 months ago
store
1 year ago
AdminDetailsPage.module.scss
11 months ago
AdminSection.tsx
1 year ago
ConfirmationDialog.tsx
11 months ago
DefaultPrimaryActionButton.tsx
1 year ago
index.tsx
11 months ago
types.ts
1 year ago
utils.ts
11 months ago
utils.ts
29 lines
| 1 | /** |
| 2 | * @since 4.4.0 |
| 3 | */ |
| 4 | export function amountFormatter(currency: Intl.NumberFormatOptions['currency'], options?: Intl.NumberFormatOptions): Intl.NumberFormat { |
| 5 | return new Intl.NumberFormat(navigator.language, { |
| 6 | style: 'currency', |
| 7 | currency: currency, |
| 8 | ...options |
| 9 | }); |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * @since 4.6.0 |
| 14 | */ |
| 15 | export function formatDateTimeLocal(dateString: string) { |
| 16 | if (!dateString) return ''; |
| 17 | |
| 18 | const date = new Date(dateString); |
| 19 | if (isNaN(date.getTime())) return ''; |
| 20 | |
| 21 | const year = date.getFullYear(); |
| 22 | const month = String(date.getMonth() + 1).padStart(2, '0'); |
| 23 | const day = String(date.getDate()).padStart(2, '0'); |
| 24 | const hours = String(date.getHours()).padStart(2, '0'); |
| 25 | const minutes = String(date.getMinutes()).padStart(2, '0'); |
| 26 | |
| 27 | return `${year}-${month}-${day}T${hours}:${minutes}:00`; |
| 28 | } |
| 29 |