mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 06:56:15 +00:00
#591 - monitoring
This commit is contained in:
@ -4,3 +4,30 @@ import { twMerge } from 'tailwind-merge';
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
// convert kb to gb
|
||||
export function kbToGb(kb: number | string): number {
|
||||
if (typeof kb === 'string') {
|
||||
kb = parseFloat(kb);
|
||||
}
|
||||
return Math.round((kb / 1024 / 1024) * 100) / 100;
|
||||
}
|
||||
|
||||
// convert mb to gb
|
||||
export function mbToGb(mb: number | string): number {
|
||||
if (typeof mb === 'string') {
|
||||
mb = parseFloat(mb);
|
||||
}
|
||||
return Math.round((mb / 1024) * 100) / 100;
|
||||
}
|
||||
|
||||
export function formatDateString(dateString: string | Date): string {
|
||||
const date = new Date(dateString);
|
||||
|
||||
const year = date.toLocaleString('default', { year: 'numeric' });
|
||||
const month = date.toLocaleString('default', { month: '2-digit' });
|
||||
const day = date.toLocaleString('default', { day: '2-digit' });
|
||||
|
||||
// Generate yyyy-mm-dd date string
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
|
Reference in New Issue
Block a user