Skip to content

Commit bca4d62

Browse files
committed
bugfix: fix history sort issue
1 parent a6970bf commit bca4d62

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

homepage/.vitepress/theme/components/Timeline.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ const processedEvents = computed(() => {
8383
8484
if (/^\d{4}$/.test(time)) {
8585
type = 'year'
86-
sortKey = time + '-12-31'
86+
sortKey = time + '-99-99-2'
8787
userYears.add(time)
8888
} else if (/^\d{4}-\d{2}$/.test(time)) {
8989
type = 'month'
90-
sortKey = time + '-31'
90+
sortKey = time + '-99-1'
9191
userMonths.add(time)
9292
const year = time.substring(0, 4)
9393
if (!yearsWithEvents.has(year)) yearsWithEvents.set(year, [])
9494
} else if (/^\d{4}-\d{2}-\d{2}$/.test(time)) {
9595
type = 'day'
96-
sortKey = time
96+
sortKey = time + '-0'
9797
const year = time.substring(0, 4)
9898
const month = time.substring(0, 7)
9999
@@ -102,7 +102,7 @@ const processedEvents = computed(() => {
102102
monthsWithEvents.get(month)!.push(time)
103103
} else {
104104
type = 'day'
105-
sortKey = time
105+
sortKey = time + '-0'
106106
}
107107
108108
const isCurrent = sortKey === todayDate
@@ -126,7 +126,7 @@ const processedEvents = computed(() => {
126126
time: todayDate,
127127
description: '',
128128
type: 'day',
129-
sortKey: todayDate,
129+
sortKey: todayDate + '-0',
130130
isGenerated: false,
131131
isCurrent: true
132132
})
@@ -152,7 +152,7 @@ const processedEvents = computed(() => {
152152
type: 'year',
153153
time: year,
154154
description: year + '',
155-
sortKey: year + '-12-31',
155+
sortKey: year + '-99-99-2',
156156
isGenerated: true
157157
})
158158
}
@@ -166,7 +166,7 @@ const processedEvents = computed(() => {
166166
type: 'month',
167167
time: `${year}年${monthNum}月`,
168168
description: `${year}年${monthNum}月`,
169-
sortKey: month + '-31',
169+
sortKey: month + '-99-1',
170170
isGenerated: true
171171
})
172172
}

0 commit comments

Comments
 (0)