feat: analytic

This commit is contained in:
ferdiansyah783
2025-08-08 17:59:39 +07:00
parent 7beee4c3a1
commit 67b747f0ff
34 changed files with 1227 additions and 2834 deletions
+14 -5
View File
@@ -6,6 +6,15 @@ export const formatCurrency = (amount: number) => {
}).format(amount)
}
export const formatShortCurrency = (num: number): string => {
if (num >= 1_000_000) {
return (num / 1_000_000).toFixed(2) + 'M'
} else if (num >= 1_000) {
return (num / 1_000).toFixed(2) + 'k'
}
return num.toString()
}
export const formatDate = (dateString: string) => {
return new Date(dateString).toLocaleDateString('en-US', {
year: 'numeric',
@@ -17,8 +26,8 @@ export const formatDate = (dateString: string) => {
}
export const formatDateDDMMYYYY = (date: Date) => {
const day = String(date.getDate()).padStart(2, '0')
const month = String(date.getMonth() + 1).padStart(2, '0')
const year = date.getFullYear()
return `${day}-${month}-${year}`
}
const day = String(date.getDate()).padStart(2, '0')
const month = String(date.getMonth() + 1).padStart(2, '0')
const year = date.getFullYear()
return `${day}-${month}-${year}`
}