import dateMath from '@elastic/datemath' ; export type Unit = 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'M' | 'y' ; export const leastCommonInterval = ( num = 0 , base = 0 ) => Math . max ( Math . ceil ( num / base ) * base , base ) ; export const isCalendarInterval = ( { unit , value } ) => { const { unitsMap } = dateMath ; return value === 1 && [ 'calendar' , 'mixed' ] . includes ( unitsMap [ unit ] . type ) ; } ;