ldc-supportweb/resources/ts/lib/utils.tsx
2026-04-24 16:53:58 +02:00

41 lines
909 B
TypeScript

// * Packages
import { useFormatedDate } from "@/hooks/use-formated-value";
import useTrans, { UseTransOptions } from "@/hooks/use-translations";
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
/**
* 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);
};