Spaces:
Running
Running
Commit
·
7f4d055
1
Parent(s):
ec1a9c4
fix time shows not properly
Browse files- src/components/AgentFilters.vue +16 -5
- src/views/LeaderboardView.vue +10 -3
src/components/AgentFilters.vue
CHANGED
|
@@ -186,18 +186,29 @@ export default {
|
|
| 186 |
initializeSlider() {
|
| 187 |
if (this.hasDateBounds) {
|
| 188 |
// 查找 2025-08-01 在日期数组中的索引
|
| 189 |
-
const
|
| 190 |
let startIndex = 0
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
// 如果默认起始日期在范围内,找到对应的索引
|
| 193 |
-
if (
|
| 194 |
startIndex = this.allDates.findIndex(d => {
|
| 195 |
-
const dateStr = d.toISOString().split('T')[0]
|
| 196 |
-
return dateStr ===
|
| 197 |
})
|
| 198 |
// 如果没找到精确日期,找最接近的日期
|
| 199 |
if (startIndex === -1) {
|
| 200 |
-
startIndex = this.allDates.findIndex(d =>
|
|
|
|
|
|
|
|
|
|
| 201 |
if (startIndex === -1) startIndex = 0
|
| 202 |
}
|
| 203 |
}
|
|
|
|
| 186 |
initializeSlider() {
|
| 187 |
if (this.hasDateBounds) {
|
| 188 |
// 查找 2025-08-01 在日期数组中的索引
|
| 189 |
+
const targetDateStr = '2025-08-01'
|
| 190 |
let startIndex = 0
|
| 191 |
|
| 192 |
+
// Normalize date bounds to strings for comparison
|
| 193 |
+
const minDateStr = this.dateBounds.min instanceof Date
|
| 194 |
+
? this.dateBounds.min.toISOString().split('T')[0]
|
| 195 |
+
: (typeof this.dateBounds.min === 'string' ? this.dateBounds.min.split('T')[0] : '')
|
| 196 |
+
const maxDateStr = this.dateBounds.max instanceof Date
|
| 197 |
+
? this.dateBounds.max.toISOString().split('T')[0]
|
| 198 |
+
: (typeof this.dateBounds.max === 'string' ? this.dateBounds.max.split('T')[0] : '')
|
| 199 |
+
|
| 200 |
// 如果默认起始日期在范围内,找到对应的索引
|
| 201 |
+
if (targetDateStr >= minDateStr && targetDateStr <= maxDateStr) {
|
| 202 |
startIndex = this.allDates.findIndex(d => {
|
| 203 |
+
const dateStr = d instanceof Date ? d.toISOString().split('T')[0] : (typeof d === 'string' ? d.split('T')[0] : '')
|
| 204 |
+
return dateStr === targetDateStr
|
| 205 |
})
|
| 206 |
// 如果没找到精确日期,找最接近的日期
|
| 207 |
if (startIndex === -1) {
|
| 208 |
+
startIndex = this.allDates.findIndex(d => {
|
| 209 |
+
const dateStr = d instanceof Date ? d.toISOString().split('T')[0] : (typeof d === 'string' ? d.split('T')[0] : '')
|
| 210 |
+
return dateStr >= targetDateStr
|
| 211 |
+
})
|
| 212 |
if (startIndex === -1) startIndex = 0
|
| 213 |
}
|
| 214 |
}
|
src/views/LeaderboardView.vue
CHANGED
|
@@ -94,7 +94,6 @@ import { countNonTradingDaysBetweenForAsset, countTradingDaysBetweenForAsset } f
|
|
| 94 |
import { computeBuyHoldEquity, computeStrategyEquity, calculateMetricsFromSeries, computeWinRate } from '../lib/perf.js'
|
| 95 |
import { STRATEGIES } from '../lib/strategies.js'
|
| 96 |
import emailjs from 'emailjs-com'
|
| 97 |
-
|
| 98 |
export default {
|
| 99 |
name: 'LeaderboardView',
|
| 100 |
components: { AgentTable, AgentFilters, AssetsFilter, CompareChartE, Dialog, InputText },
|
|
@@ -208,9 +207,17 @@ export default {
|
|
| 208 |
try {
|
| 209 |
const isCrypto = row.asset === 'BTC' || row.asset === 'ETH'
|
| 210 |
const seriesAll = Array.isArray(row.series) ? row.series : []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
const inRange = seriesAll.filter(p => {
|
| 212 |
-
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
| 214 |
})
|
| 215 |
if (!inRange.length) return null
|
| 216 |
// Get correct strategy config - row.strategy is the ID, we need the strategy type
|
|
|
|
| 94 |
import { computeBuyHoldEquity, computeStrategyEquity, calculateMetricsFromSeries, computeWinRate } from '../lib/perf.js'
|
| 95 |
import { STRATEGIES } from '../lib/strategies.js'
|
| 96 |
import emailjs from 'emailjs-com'
|
|
|
|
| 97 |
export default {
|
| 98 |
name: 'LeaderboardView',
|
| 99 |
components: { AgentTable, AgentFilters, AssetsFilter, CompareChartE, Dialog, InputText },
|
|
|
|
| 207 |
try {
|
| 208 |
const isCrypto = row.asset === 'BTC' || row.asset === 'ETH'
|
| 209 |
const seriesAll = Array.isArray(row.series) ? row.series : []
|
| 210 |
+
|
| 211 |
+
// Normalize dates to YYYY-MM-DD format for comparison to avoid timezone issues
|
| 212 |
+
const startDateStr = start instanceof Date ? start.toISOString().split('T')[0] : (typeof start === 'string' ? start.split('T')[0] : start)
|
| 213 |
+
const endDateStr = end instanceof Date ? end.toISOString().split('T')[0] : (typeof end === 'string' ? end.split('T')[0] : end)
|
| 214 |
+
|
| 215 |
const inRange = seriesAll.filter(p => {
|
| 216 |
+
if (!p || !p.date) return false
|
| 217 |
+
// Extract date part (YYYY-MM-DD) from the date string
|
| 218 |
+
const dateStr = typeof p.date === 'string' ? p.date.split('T')[0] : new Date(p.date).toISOString().split('T')[0]
|
| 219 |
+
// Use string comparison for dates to avoid timezone issues
|
| 220 |
+
return dateStr >= startDateStr && dateStr <= endDateStr
|
| 221 |
})
|
| 222 |
if (!inRange.length) return null
|
| 223 |
// Get correct strategy config - row.strategy is the ID, we need the strategy type
|