historical bars fill fix

This commit is contained in:
tim
2024-10-26 19:58:54 -04:00
parent ffdb60afa2
commit cf7eb637bc
3 changed files with 13 additions and 10 deletions

View File

@@ -226,11 +226,14 @@ export function linspace(a, b, n) {
export function intervalToSeconds(interval) {
if (interval.endsWith('T'))
throw Error('Tick intervals not supported')
return interval.endsWith('M') ? 30 * 24 * 60 * 60
: interval.endsWith('W') ? 7 * 24 * 60 * 60
: interval.endsWith('D') ? 24 * 60 * 60
: interval.endsWith('S') ? 1
: 60 // if no unit char, then it's minutes
const unit = interval.endsWith('M') ? 30 * 24 * 60 * 60
: interval.endsWith('W') ? 7 * 24 * 60 * 60
: interval.endsWith('D') ? 24 * 60 * 60
: interval.endsWith('S') ? 1
: 60 // if no unit char, then it's minutes
const result = parseInt(/\d+/.exec(interval)[0]) * unit
console.log('intervalToSeconds', interval, result)
return result
}