mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-21 05:45:46 +00:00
30 lines
758 B
TypeScript
30 lines
758 B
TypeScript
import moment from 'moment';
|
|
import { twMerge } from 'tailwind-merge';
|
|
import clsx, { ClassValue } from 'clsx';
|
|
|
|
export const sleep = (ms: number = 1000) =>
|
|
new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
|
export const formatDate = (date: moment.MomentInput, format?: string) => {
|
|
return moment(date).format(format);
|
|
};
|
|
|
|
export const cn = (...inputs: ClassValue[]) => {
|
|
return twMerge(clsx(inputs));
|
|
};
|
|
|
|
export const formatCurrency = (
|
|
value: number | bigint | Intl.StringNumericLiteral,
|
|
currency = 'USD',
|
|
locale = 'en-US',
|
|
minimumFractionDigits = 0,
|
|
maximumFractionDigits = 2
|
|
) => {
|
|
return new Intl.NumberFormat(locale, {
|
|
style: 'currency',
|
|
currency,
|
|
minimumFractionDigits,
|
|
maximumFractionDigits,
|
|
}).format(value);
|
|
};
|