Compare commits

...

2 Commits

Author SHA1 Message Date
qiuchenfan 12e66397d8 Merge branch 'main' of http://113.45.67.59:3003/lzq/test 2025-11-17 18:57:43 +08:00
qiuchenfan 374f5b7672 qiu4 2025-11-17 18:57:40 +08:00
1 changed files with 9 additions and 0 deletions

View File

@ -4,3 +4,12 @@ import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export const formatTemperature = (
temp: number,
unit: 'celsius' | 'fahrenheit' = 'celsius'
): string => {
const value = unit === 'fahrenheit' ? (temp * 9) / 5 + 32 : temp;
const symbol = unit === 'fahrenheit' ? '°F' : '°C';
return `${Math.round(value)}${symbol}`;
};