Files
star-erp/resources/js/lib/utils.ts

14 lines
444 B
TypeScript
Raw Normal View History

2025-12-30 15:03:19 +08:00
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function formatQuantity(value: number | string): string {
const num = typeof value === 'string' ? parseFloat(value) : value;
if (isNaN(num)) return '0';
// 使用 Number() 會自動去除末尾無意義的 0
return String(Number(num.toFixed(4)));
}