mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 11:01:45 +00:00
feat(ui): padroniza avatares e paleta visual da interface
This commit is contained in:
@@ -296,6 +296,23 @@ export function addMonthsToDate(value: Date, offset: number): Date {
|
||||
// DATE FORMATTING
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Formats a UTC date/datetime to short display format (weekday + day + month), capitalized.
|
||||
* Use this for timestamps stored as UTC (e.g. transaction dates from the DB).
|
||||
* @example
|
||||
* formatTransactionDate("2024-11-14T00:00:00Z") // "Qui 14 nov"
|
||||
*/
|
||||
export function formatTransactionDate(date: Date | string): string {
|
||||
const d = date instanceof Date ? date : new Date(date);
|
||||
const formatted = new Intl.DateTimeFormat("pt-BR", {
|
||||
weekday: "short",
|
||||
day: "2-digit",
|
||||
month: "short",
|
||||
timeZone: "UTC",
|
||||
}).format(d);
|
||||
return formatted.charAt(0).toUpperCase() + formatted.slice(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a date value to short display format
|
||||
* @example
|
||||
|
||||
Reference in New Issue
Block a user