More
This commit is contained in:
parent
1f68ca0512
commit
3599803589
43 changed files with 3578 additions and 262 deletions
|
|
@ -28,6 +28,17 @@ export function formatDuration(d: string): string {
|
|||
return d;
|
||||
}
|
||||
|
||||
const MONTH_NAMES = [
|
||||
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
||||
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
||||
];
|
||||
|
||||
export function formatTransactionDate(fractionalYear: number): string {
|
||||
const year = Math.floor(fractionalYear);
|
||||
const monthIndex = Math.min(Math.round((fractionalYear - year) * 12), 11);
|
||||
return `${MONTH_NAMES[monthIndex]} ${year}`;
|
||||
}
|
||||
|
||||
export function formatAge(value: number, approximate = true): string {
|
||||
if (value >= 1000) return approximate ? `~${Math.round(value)}` : `${Math.round(value)}`;
|
||||
return Math.round(value).toString();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue