historical bars fill fix
This commit is contained in:
13
src/misc.js
13
src/misc.js
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user