The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { useLingui } from '@lingui/react/macro';
import { dateLocaleState } from '@/localization/states/dateLocaleState';
import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';
export const useGetAddedRelativeDateDescription = () => {
const { t } = useLingui();
const { localeCatalog } = useAtomStateValue(dateLocaleState);
const getAddedRelativeDateDescription = (createdAt: string) => {
const beautifiedCreatedAt = beautifyPastDateRelativeToNow(
createdAt,
localeCatalog,
);
return t`Added ${beautifiedCreatedAt}`;
};
return { getAddedRelativeDateDescription };
};