diff --git a/pages/cart/publishers/index.tsx b/pages/cart/publishers/index.tsx index e96c934..7f9e7ae 100644 --- a/pages/cart/publishers/index.tsx +++ b/pages/cart/publishers/index.tsx @@ -222,6 +222,14 @@ function PublishersPage({ publishers = [] }: IProps) { const exportFilteredPublishers = () => { try { // Calculate total statistics + const formatDateBG = (date) => { + if (!date) return ''; + return new Date(date).toLocaleDateString('bg-BG', { + day: '2-digit', + month: '2-digit', + year: 'numeric' + }); + }; const stats = { totalPublishers: shownPubs.length, activePublishers: shownPubs.filter(p => p.isActive).length, @@ -244,15 +252,14 @@ function PublishersPage({ publishers = [] }: IProps) { 'Active': publisher.isActive ? 'Yes' : 'No', 'Trained': publisher.isTrained ? 'Yes' : 'No', 'Role': publisher.role ? 'Yes' : 'No', - 'Last Login': publisher.lastLogin ? new Date(publisher.lastLogin).toLocaleDateString() : 'Never', + 'Last Login': publisher.lastLogin ? formatDateBG(publisher.lastLogin) : 'Never', 'Subscribed to Reminders': publisher.isSubscribedToReminders ? 'Yes' : 'No', 'Subscribed to CoverMe': publisher.isSubscribedToCoverMe ? 'Yes' : 'No', 'Family Head ID': publisher.familyHeadId || '', 'Assignments Count': publisher.assignments.length, 'Availabilities Count': publisher.availabilities.length, 'Last Assignment': publisher.assignments.length > 0 - ? new Date(Math.max(...publisher.assignments.map(a => new Date(a.shift.startTime)))).toLocaleDateString() - : 'Never', + ? formatDateBG(Math.max(...publisher.assignments.map(a => new Date(a.shift.startTime)))) : 'Never', })); // Create workbook @@ -293,7 +300,7 @@ function PublishersPage({ publishers = [] }: IProps) { ['Subscribed to Reminders', stats.subscribedToReminders], ['Subscribed to CoverMe', stats.subscribedToCoverMe], ['Family Heads', stats.familyHeads], - ['Export Date', new Date().toLocaleDateString()], + ['Export Date', formatDateBG(new Date())], [''], ['Applied Filters:', ''], ['Name Filter', filter || 'None'], @@ -322,7 +329,7 @@ function PublishersPage({ publishers = [] }: IProps) { }); // Generate filename with current date and filter indication - const date = new Date().toISOString().split('T')[0]; + const date = formatDateBG(new Date()).replace(/\./g, '-'); const isFiltered = filter || showZeroShiftsOnly || flterNoTraining; const filename = `publishers-${isFiltered ? 'filtered-' : ''}${date}.xlsx`;