Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 81393x 3x 2x 2x 14x 14x 14x 6x | import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
/**
* Format a date string to a localized date (e.g., "14 Dec 2024")
*/
export function formatDate(dateStr: string): string {
return new Date(dateStr).toLocaleDateString("en-IN", {
day: "numeric",
month: "short",
year: "numeric",
});
}
/**
* Format a date string to a localized date with time (e.g., "14 Dec 2024, 10:30 AM")
*/
export function formatDateTime(dateStr: string): string {
return new Date(dateStr).toLocaleDateString("en-IN", {
day: "numeric",
month: "short",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
});
}
/**
* Format a date string to a localized date with time and long month (e.g., "14 December 2024, 10:30 AM")
*/
export function formatDateTimeLong(dateStr: string): string {
return new Date(dateStr).toLocaleString("en-IN", {
day: "numeric",
month: "long",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
});
}
/**
* Format a number in Indian numbering system (e.g., 200000 → "2,00,000")
*/
export function formatIndianNumber(value: string | number): string {
const num = typeof value === "string" ? value.replace(/\D/g, "") : String(value);
Iif (!num) return "";
return Number(num).toLocaleString("en-IN");
}
/**
* Parse a formatted Indian number string back to raw digits (e.g., "2,00,000" → "200000")
*/
export function parseIndianNumber(value: string): string {
return value.replace(/,/g, "");
}
|