Fix minutes ordering

This commit is contained in:
TheMaddax 2025-03-25 18:12:19 -05:00
parent 09893fcb5d
commit 6c8766e77a
3 changed files with 15 additions and 4 deletions

View file

@ -53,9 +53,16 @@ const Minutes: React.FC = () => {
}, []);
const sortedMinutes = [...minutesData].sort((a, b) => {
if (a[sortColumn] < b[sortColumn]) return sortDirection === 'asc' ? -1 : 1;
if (a[sortColumn] > b[sortColumn]) return sortDirection === 'asc' ? 1 : -1;
return 0;
if (sortColumn === 'date') {
// Convert date strings to Date objects for proper comparison
const dateA = new Date(a.date.split('/').map((part, i) => i === 0 ? part : i === 1 ? part : part).join('/'));
const dateB = new Date(b.date.split('/').map((part, i) => i === 0 ? part : i === 1 ? part : part).join('/'));
return sortDirection === 'asc' ? dateA.getTime() - dateB.getTime() : dateB.getTime() - dateA.getTime();
} else {
if (a[sortColumn] < b[sortColumn]) return sortDirection === 'asc' ? -1 : 1;
if (a[sortColumn] > b[sortColumn]) return sortDirection === 'asc' ? 1 : -1;
return 0;
}
});
const handleSort = (column: keyof MinuteEntry) => {

View file

@ -9,7 +9,10 @@ Adding new meeting minutes to the website:
## Recent Changes
1. Modified Minutes.tsx to include new meeting entry
2. File structure:
2. Fixed date sorting issue:
- Updated sorting logic to convert date strings to Date objects
- Ensures proper chronological sorting regardless of date format
3. File structure:
- PDF file location: client/public/minutes/minutes-02082025.pdf
- Component location: client/src/components/Minutes.tsx

View file

@ -17,6 +17,7 @@
- PDF file added to public/minutes/
- Updated Minutes.tsx component
- Reordered minutes data from newest (top) to oldest (bottom) in the source array
- Fixed date sorting issue by converting strings to Date objects for comparison
2. Deployment (in progress):
- Changes pushed to git repository