formatters
sdlc-cdk-lib / frontend/src/utils/formatters
frontend/src/utils/formatters
Functions
formatCurrency()
> formatCurrency(amount, currency): string
Defined in: frontend/src/utils/formatters.ts:7
Format a number as a currency string
Parameters
amount
number
The amount to format
currency
string = 'GBP'
The currency code (default: GBP)
Returns
string
Formatted currency string
formatDate()
> formatDate(date): string
Defined in: frontend/src/utils/formatters.ts:20
Format a date string or Date object to a human-readable date
Parameters
date
Date string or object
string | Date
Returns
string
Formatted date string
formatDateTime()
> formatDateTime(date): string
Defined in: frontend/src/utils/formatters.ts:33
Format a date string or Date object to include time
Parameters
date
Date string or object
string | Date
Returns
string
Formatted date and time string
toTitleCase()
> toTitleCase(text): string
Defined in: frontend/src/utils/formatters.ts:59
Convert a string to title case
Parameters
text
string
The text to convert
Returns
string
Text in title case
truncateText()
> truncateText(text, maxLength): string
Defined in: frontend/src/utils/formatters.ts:49
Truncate text to a specific length and add ellipsis if needed
Parameters
text
string
The text to truncate
maxLength
number
Maximum length before truncation
Returns
string
Truncated text with ellipsis if needed