qiu4
This commit is contained in:
parent
34ee14ecd4
commit
374f5b7672
|
|
@ -4,3 +4,12 @@ import { twMerge } from "tailwind-merge"
|
||||||
export function cn(...inputs: ClassValue[]) {
|
export function cn(...inputs: ClassValue[]) {
|
||||||
return twMerge(clsx(inputs))
|
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}`;
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue