Skip to content

Commit

Permalink
fix: default sorting logic in student list
Browse files Browse the repository at this point in the history
- Ensure consistent sorting behavior between browser
  • Loading branch information
U1805 committed Jan 29, 2025
1 parent b38ce65 commit 2579f47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ const processData = debounce(() => {
// sort
.sort((a, b) => {
if (filter_condition.value.sort_type === '') {
return filter_condition.value.sort_asc ? -1 : 1
return filter_condition.value.sort_asc ?
database.value.indexOf(a) - database.value.indexOf(b) :
database.value.indexOf(b) - database.value.indexOf(a)
}
if (filter_condition.value.sort_type === 'Birthday') {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/requestUtils/dateFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const birthday_sort = (a: studentInfo, b: studentInfo, lng: SupportedLang
return yesterday
}
const [month, day] = birthday.split('/').map(Number)
return new Date(currentYear, month - 1, day - 1)
return new Date(currentYear, month - 1, day)
}

const aDate = getDateFromBirthday(a.Birthday)
Expand Down

0 comments on commit 2579f47

Please sign in to comment.