tuning import. listing, edit

This commit is contained in:
2023-10-25 08:46:42 +07:00
parent f53945e4a0
commit 5265aecd05
20 changed files with 1023 additions and 566 deletions

View File

@@ -1,3 +1,5 @@
import { string } from "yup";
export function clearTag(htmlString: string | undefined) {
return htmlString?.replace(/(<([^>]+)>)/gi, "");
}
@@ -9,3 +11,9 @@ export function limitString(anyString: string | undefined, limit: number = 50) {
export function makeExcerpt(htmlString: string | undefined, limit: number = 50) {
return limitString(clearTag(htmlString ?? ''), limit);
}
export function capitalizeFirstLetter(text: string) {
return text.charAt(0).toUpperCase() + text.slice(1);
}

View File

@@ -10,6 +10,10 @@ export function fDateTime(date: Date | string | number) {
return format(new Date(date), 'dd MMM yyyy p');
}
export function fDateTimesecond(date: Date | string | number) {
return format(new Date(date), 'dd MMM yyyy HH:mm:ss');
}
export function fTimestamp(date: Date | string | number) {
return getTime(new Date(date));
}