21 lines
524 B
TypeScript

export const formatNumberWithPeriods = (number: number) => {
return new Intl.NumberFormat('id-ID').format(number)
}
export const formatDate = (isoDate: string): string => {
if (!isoDate) return '-'
const date = new Date(isoDate)
return new Intl.DateTimeFormat('id-ID', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}).format(date)
}
export const urlFriendlyCode = (input: string) => {
return input
.trim()
.toLowerCase()
.replaceAll(/\s+/g, '-')
.replaceAll(/[^\w-]+/g, '')
}