mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-17 19:49:40 +02:00
fix lint
This commit is contained in:
parent
16cb8e753b
commit
e9caa4a217
46 changed files with 1784 additions and 728 deletions
|
|
@ -17,7 +17,7 @@ export type LocaleKey = keyof typeof locales;
|
|||
*/
|
||||
export function formatDate(
|
||||
date: string | Date,
|
||||
formatStr: string = 'PPP',
|
||||
formatStr = 'PPP',
|
||||
locale: LocaleKey = 'de'
|
||||
): string {
|
||||
const dateObj = typeof date === 'string' ? parseISO(date) : date;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export function formatDurationHumanReadable(seconds: number, locale: 'en' | 'de'
|
|||
/**
|
||||
* Format file size from bytes to human readable string
|
||||
*/
|
||||
export function formatFileSize(bytes: number, decimals: number = 1): string {
|
||||
export function formatFileSize(bytes: number, decimals = 1): string {
|
||||
if (bytes === 0) return '0 B';
|
||||
if (!Number.isFinite(bytes) || bytes < 0) return '--';
|
||||
|
||||
|
|
@ -107,18 +107,14 @@ export function formatFileSize(bytes: number, decimals: number = 1): string {
|
|||
/**
|
||||
* Format number with thousands separator
|
||||
*/
|
||||
export function formatNumber(num: number, locale: string = 'de-DE'): string {
|
||||
export function formatNumber(num: number, locale = 'de-DE'): string {
|
||||
return num.toLocaleString(locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format currency
|
||||
*/
|
||||
export function formatCurrency(
|
||||
amount: number,
|
||||
currency: string = 'EUR',
|
||||
locale: string = 'de-DE'
|
||||
): string {
|
||||
export function formatCurrency(amount: number, currency = 'EUR', locale = 'de-DE'): string {
|
||||
return new Intl.NumberFormat(locale, {
|
||||
style: 'currency',
|
||||
currency,
|
||||
|
|
@ -128,11 +124,7 @@ export function formatCurrency(
|
|||
/**
|
||||
* Format percentage
|
||||
*/
|
||||
export function formatPercent(
|
||||
value: number,
|
||||
decimals: number = 0,
|
||||
locale: string = 'de-DE'
|
||||
): string {
|
||||
export function formatPercent(value: number, decimals = 0, locale = 'de-DE'): string {
|
||||
return new Intl.NumberFormat(locale, {
|
||||
style: 'percent',
|
||||
minimumFractionDigits: decimals,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export function capitalize(str: string): string {
|
|||
/**
|
||||
* Generate a random string ID
|
||||
*/
|
||||
export function generateId(length: number = 8): string {
|
||||
export function generateId(length = 8): string {
|
||||
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
let result = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue