import { format as dateFnsFormat } from "date-fns" ; import { id } from "date-fns/locale" ; export function classNames ( classes ) { return classes . filter ( ( cls ) => typeof cls === "string" && cls ) . join ( " " ) ; } type ClassProp = null | undefined | string | string [ ] ; export function mergeClasses ( classA , classB ) { const toArray = ( classes ) => typeof classes === "string" ? classes . split ( " " ) : [ ... classes ] ; return [ ... toArray ( classA || [ ] ) , ... toArray ( classB || [ ] ) ] . join ( " " ) ; } export async function timeout ( duration ) { return new Promise ( ( resolve ) => setTimeout ( resolve , duration ) ) ; } export function dateFormat ( date , format ) { return dateFnsFormat ( date , format , { locale : id } ) ; } export function isSameDate ( a , b ) { return a . toDateString ( ) === b . toDateString ( ) ; }