feat: implement full page components and validation schema; enhance translations and form handling
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import { DateUtils } from '@repo/utils';
|
||||
|
||||
export interface RenderDateProps {
|
||||
value?: string | number | Date | DateUtils | null;
|
||||
format?: string;
|
||||
fallback?: string;
|
||||
}
|
||||
|
||||
export function RenderDate({ value, format = 'DD-MM-YYYY, HH:mm', fallback = '-' }: RenderDateProps) {
|
||||
if (!value) return <>{fallback}</>;
|
||||
|
||||
try {
|
||||
const parsedValue = typeof value === 'string' && !isNaN(Number(value)) ? Number(value) : value;
|
||||
return <>{new DateUtils(parsedValue as any).format(format)}</>;
|
||||
} catch (error) {
|
||||
return <>{fallback}</>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user