import { clsx, type ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } export function formatDate(date: string | Date) { return new Date(date).toLocaleDateString("id-ID", { year: "numeric", month: "long", day: "numeric", }); } export function formatDateTime(date: string | Date) { const d = new Date(date); // Use UTC methods to avoid timezone conversion const day = String(d.getUTCDate()).padStart(2, '0'); const month = String(d.getUTCMonth() + 1).padStart(2, '0'); const year = String(d.getUTCFullYear()).slice(-2); const hours = String(d.getUTCHours()).padStart(2, '0'); const minutes = String(d.getUTCMinutes()).padStart(2, '0'); return `${day}/${month}/${year} ${hours}.${minutes}`; } export function truncate(str: string, length: number) { return str.length > length ? str.substring(0, length) + "..." : str; }