dates in BG format
This commit is contained in:
@ -222,6 +222,14 @@ function PublishersPage({ publishers = [] }: IProps) {
|
|||||||
const exportFilteredPublishers = () => {
|
const exportFilteredPublishers = () => {
|
||||||
try {
|
try {
|
||||||
// Calculate total statistics
|
// 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 = {
|
const stats = {
|
||||||
totalPublishers: shownPubs.length,
|
totalPublishers: shownPubs.length,
|
||||||
activePublishers: shownPubs.filter(p => p.isActive).length,
|
activePublishers: shownPubs.filter(p => p.isActive).length,
|
||||||
@ -244,15 +252,14 @@ function PublishersPage({ publishers = [] }: IProps) {
|
|||||||
'Active': publisher.isActive ? 'Yes' : 'No',
|
'Active': publisher.isActive ? 'Yes' : 'No',
|
||||||
'Trained': publisher.isTrained ? 'Yes' : 'No',
|
'Trained': publisher.isTrained ? 'Yes' : 'No',
|
||||||
'Role': publisher.role ? '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 Reminders': publisher.isSubscribedToReminders ? 'Yes' : 'No',
|
||||||
'Subscribed to CoverMe': publisher.isSubscribedToCoverMe ? 'Yes' : 'No',
|
'Subscribed to CoverMe': publisher.isSubscribedToCoverMe ? 'Yes' : 'No',
|
||||||
'Family Head ID': publisher.familyHeadId || '',
|
'Family Head ID': publisher.familyHeadId || '',
|
||||||
'Assignments Count': publisher.assignments.length,
|
'Assignments Count': publisher.assignments.length,
|
||||||
'Availabilities Count': publisher.availabilities.length,
|
'Availabilities Count': publisher.availabilities.length,
|
||||||
'Last Assignment': publisher.assignments.length > 0
|
'Last Assignment': publisher.assignments.length > 0
|
||||||
? new Date(Math.max(...publisher.assignments.map(a => new Date(a.shift.startTime)))).toLocaleDateString()
|
? formatDateBG(Math.max(...publisher.assignments.map(a => new Date(a.shift.startTime)))) : 'Never',
|
||||||
: 'Never',
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Create workbook
|
// Create workbook
|
||||||
@ -293,7 +300,7 @@ function PublishersPage({ publishers = [] }: IProps) {
|
|||||||
['Subscribed to Reminders', stats.subscribedToReminders],
|
['Subscribed to Reminders', stats.subscribedToReminders],
|
||||||
['Subscribed to CoverMe', stats.subscribedToCoverMe],
|
['Subscribed to CoverMe', stats.subscribedToCoverMe],
|
||||||
['Family Heads', stats.familyHeads],
|
['Family Heads', stats.familyHeads],
|
||||||
['Export Date', new Date().toLocaleDateString()],
|
['Export Date', formatDateBG(new Date())],
|
||||||
[''],
|
[''],
|
||||||
['Applied Filters:', ''],
|
['Applied Filters:', ''],
|
||||||
['Name Filter', filter || 'None'],
|
['Name Filter', filter || 'None'],
|
||||||
@ -322,7 +329,7 @@ function PublishersPage({ publishers = [] }: IProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Generate filename with current date and filter indication
|
// 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 isFiltered = filter || showZeroShiftsOnly || flterNoTraining;
|
||||||
const filename = `publishers-${isFiltered ? 'filtered-' : ''}${date}.xlsx`;
|
const filename = `publishers-${isFiltered ? 'filtered-' : ''}${date}.xlsx`;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user