import React from 'react';
import { Text } from '@wix/design-system';
import { CellViewLayout } from '../CellViewLayout';
const dateFormatter = new Intl.DateTimeFormat(undefined, {
    day: '2-digit',
    month: '2-digit',
    year: 'numeric',
});
function formatDate(value) {
    if (!value) {
        return '';
    }
    const date = value instanceof Date ? value : new Date(value);
    if (isNaN(date.getTime())) {
        return typeof value === 'string' ? value : '';
    }
    return dateFormatter.format(date);
}
export const DateView = ({ value, }) => (React.createElement(CellViewLayout, null,
    React.createElement(Text, { size: "small", ellipsis: true }, formatDate(value))));
//# sourceMappingURL=View.js.map