ldc-ker-chant/resources/ts/lib/utils.tsx
2026-07-10 11:32:24 +02:00

41 lines
901 B
TypeScript

import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
import { useFormatedDate } from "@/hooks/use-formated-value";
import useTrans, { type UseTransOptions } from "@/hooks/use-translations";
/**
* Merge classes.
* @param inputs ClassValue[]
* @returns string
*/
export function cn(...inputs: ClassValue[]): string {
return twMerge(clsx(inputs));
}
/**
* Get the translation value.
*
* @param keyName string
* @param options UseTransOptions|null
* @return string
*/
export const GetTranslation = (keyName: string, options?: UseTransOptions) => {
return useTrans(keyName, options);
};
/**
* Get the formated date.
*
* @param string date
* @param string timezone
* @param boolean time
* @returns
*/
export const GetFormatedDate = (
date: string,
timezone?: string,
time?: boolean,
) => {
return useFormatedDate(date, timezone, time);
};