feat: implement sysadmin subscription management and plan usage cycle recalculation tools
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { format, isValid, parseISO } from 'date-fns';
|
||||
import { es } from 'date-fns/locale';
|
||||
|
||||
const parseDate = (value?: string) => {
|
||||
if (!value) return null;
|
||||
const parsedDate = parseISO(value);
|
||||
return isValid(parsedDate) ? parsedDate : null;
|
||||
};
|
||||
|
||||
export const formatDate = (value?: string) => {
|
||||
const parsedDate = parseDate(value);
|
||||
return parsedDate ? format(parsedDate, 'dd MMM yyyy', { locale: es }) : value || '-';
|
||||
};
|
||||
|
||||
export const formatDateTime = (value?: string) => {
|
||||
const parsedDate = parseDate(value);
|
||||
return parsedDate ? format(parsedDate, "dd MMM yyyy, HH:mm 'hs'", { locale: es }) : value || '-';
|
||||
};
|
||||
Reference in New Issue
Block a user