Migrate to a monorepo structure (#2909)
This commit is contained in:
24
packages/twenty-front/src/utils/index.ts
Normal file
24
packages/twenty-front/src/utils/index.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { parseDate } from './date-utils';
|
||||
|
||||
export const formatToHumanReadableDate = (date: Date | string) => {
|
||||
const parsedJSDate = parseDate(date).toJSDate();
|
||||
|
||||
return new Intl.DateTimeFormat(undefined, {
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
}).format(parsedJSDate);
|
||||
};
|
||||
|
||||
export const sanitizeURL = (link: string | null | undefined) => {
|
||||
return link
|
||||
? link.replace(/(https?:\/\/)|(www\.)/g, '').replace(/\/$/, '')
|
||||
: '';
|
||||
};
|
||||
|
||||
export const getLogoUrlFromDomainName = (
|
||||
domainName?: string,
|
||||
): string | undefined => {
|
||||
const sanitizedDomain = sanitizeURL(domainName);
|
||||
return `https://favicon.twenty.com/${sanitizedDomain}`;
|
||||
};
|
||||
Reference in New Issue
Block a user