Phase 0.3: migrate date formatting to date-fns
This commit is contained in:
@@ -8,6 +8,7 @@ import { Input } from '@/components/ui/Input';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { EmptyState } from '@/components/ui/EmptyState';
|
||||
import { Badge } from '@/components/ui/Badge';
|
||||
import { formatDateTime } from '@/utils/date';
|
||||
|
||||
export function AuditLogPage() {
|
||||
const { t } = useTranslation();
|
||||
@@ -41,8 +42,7 @@ export function AuditLogPage() {
|
||||
cell: (info) => {
|
||||
const val = info.getValue();
|
||||
if (!val) return '—';
|
||||
const date = new Date(val);
|
||||
return date.toLocaleString('de-DE');
|
||||
return formatDateTime(val) || '—';
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ import { MonthView } from '@/components/calendar/MonthView';
|
||||
import { WeekView } from '@/components/calendar/WeekView';
|
||||
import { DayView } from '@/components/calendar/DayView';
|
||||
import { RangeView } from '@/components/calendar/RangeView';
|
||||
import { formatDateInput } from '@/utils/date';
|
||||
import { CalendarDetail } from '@/components/calendar/CalendarDetail';
|
||||
import { AppointmentModal } from '@/components/calendar/AppointmentModal';
|
||||
import { IcsControls } from '@/components/calendar/IcsControls';
|
||||
@@ -488,7 +489,7 @@ export function CalendarPage() {
|
||||
<label className="text-xs text-secondary-600">{t('calendar.range.start')}</label>
|
||||
<input
|
||||
type="date"
|
||||
value={rangeStart ? rangeStart.toISOString().slice(0, 10) : ''}
|
||||
value={rangeStart ? formatDateInput(rangeStart) : ''}
|
||||
onChange={(e) => setRangeStart(e.target.value ? new Date(e.target.value) : null)}
|
||||
className="text-sm rounded-md border border-secondary-300 px-2 py-1"
|
||||
data-testid="calendar-range-start"
|
||||
@@ -496,7 +497,7 @@ export function CalendarPage() {
|
||||
<label className="text-xs text-secondary-600">{t('calendar.range.end')}</label>
|
||||
<input
|
||||
type="date"
|
||||
value={rangeEnd ? rangeEnd.toISOString().slice(0, 10) : ''}
|
||||
value={rangeEnd ? formatDateInput(rangeEnd) : ''}
|
||||
onChange={(e) => setRangeEnd(e.target.value ? new Date(e.target.value) : null)}
|
||||
className="text-sm rounded-md border border-secondary-300 px-2 py-1"
|
||||
data-testid="calendar-range-end"
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { StatCard } from '@/components/shared/StatCard';
|
||||
import { ActivityFeed, ActivityItem } from '@/components/shared/ActivityFeed';
|
||||
import { useUnifiedContacts, useAuditLog } from '@/api/hooks';
|
||||
import { formatDateTime } from '@/utils/date';
|
||||
|
||||
export function DashboardPage() {
|
||||
const { t } = useTranslation();
|
||||
@@ -36,7 +37,7 @@ export function DashboardPage() {
|
||||
id: `${entry.timestamp}-${entry.user}-${entry.action}`,
|
||||
user: entry.user || 'System',
|
||||
action: entry.action || '',
|
||||
time: entry.timestamp ? new Date(entry.timestamp).toLocaleString('de-DE') : '',
|
||||
time: entry.timestamp ? (formatDateTime(entry.timestamp) || '') : '',
|
||||
avatarUrl: null,
|
||||
}));
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Card } from '@/components/ui/Card';
|
||||
import { formatDateShort } from '@/utils/date';
|
||||
import { Table, TableColumn } from '@/components/ui/Table';
|
||||
import { EmptyState } from '@/components/ui/EmptyState';
|
||||
import { Skeleton } from '@/components/ui/Skeleton';
|
||||
@@ -79,7 +80,7 @@ export function DmsTrashPage() {
|
||||
sortable: true,
|
||||
accessor: (file) => file.deleted_at || '',
|
||||
render: (file) => file.deleted_at
|
||||
? new Date(file.deleted_at).toLocaleDateString()
|
||||
? (formatDateShort(file.deleted_at) || '—')
|
||||
: '—',
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user