crud schedule
This commit is contained in:
@@ -9,3 +9,18 @@ import { twMerge } from "tailwind-merge";
|
||||
export const clx = (...classes: (string | boolean | undefined)[]): string => {
|
||||
return twMerge(classes.filter(Boolean).join(" "));
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts time string to HH:mm format
|
||||
* @param time - Time string in various formats (HH:mm:ss, HH:mm, etc.)
|
||||
* @returns Time string in HH:mm format
|
||||
*/
|
||||
export const formatTimeToHHmm = (time: string): string => {
|
||||
if (!time) return '';
|
||||
// اگر زمان به فرمت HH:mm:ss باشد، فقط HH:mm را برمیگرداند
|
||||
if (time.includes(':') && time.split(':').length === 3) {
|
||||
return time.substring(0, 5);
|
||||
}
|
||||
// اگر به فرمت HH:mm باشد، همان را برمیگرداند
|
||||
return time;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user