mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 21:35:19 +00:00
18
lib/utils.ts
18
lib/utils.ts
@@ -116,3 +116,21 @@ export function generateUUID(): string {
|
||||
return v.toString(16)
|
||||
})
|
||||
}
|
||||
|
||||
export function formatPeriodLabel(period: string, date: Date): string {
|
||||
if (period.includes("-") && period.split("-").length === 3) {
|
||||
// Daily format: show day/month/year
|
||||
return date.toLocaleDateString("en-US", {
|
||||
weekday: "short",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
year: "numeric",
|
||||
})
|
||||
} else {
|
||||
// Monthly format: show month/year
|
||||
return date.toLocaleDateString("en-US", {
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user