import moment from 'moment' ; import { calculateAuto } from './calculate_auto' ; export function getBucketSize ( { start , end , numBuckets = 50 , minBucketSize , } ) { const duration = moment . duration ( end - start , 'ms' ) ; const bucketSize = Math . max ( calculateAuto . near ( numBuckets , duration ) . asSeconds ( ) , minBucketSize || 1 ) ; return { bucketSize , intervalString : `${ bucketSize }s` } ; }