forked from Goutam/lynkeduppro-crm
50b120e184
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
714 B
TypeScript
27 lines
714 B
TypeScript
import { clsx, type ClassValue } from "clsx";
|
|
import { twMerge } from "tailwind-merge";
|
|
|
|
/**
|
|
* Merge Tailwind class names safely (handles conditional + conflicting classes).
|
|
*/
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs));
|
|
}
|
|
|
|
/** Format a number as currency (default: USD). */
|
|
export function formatCurrency(value: number, currency = "USD") {
|
|
return new Intl.NumberFormat("en-US", {
|
|
style: "currency",
|
|
currency,
|
|
}).format(value);
|
|
}
|
|
|
|
/** Format a date into a readable short form. */
|
|
export function formatDate(date: Date | string) {
|
|
return new Intl.DateTimeFormat("en-US", {
|
|
day: "2-digit",
|
|
month: "short",
|
|
year: "numeric",
|
|
}).format(new Date(date));
|
|
}
|