import moment from 'moment' ; import { IBucketDateHistogramAggConfig } from '../date_histogram' ; import { buildRangeFilter } from '../../../../../common' ; export const createFilterDateHistogram = ( agg , key ) => { const start = moment ( key ) ; const interval = agg . buckets . getInterval ( ) ; return buildRangeFilter ( agg . params . field , { gte : start . toISOString ( ) , lt : start . add ( interval ) . toISOString ( ) , format : 'strict_date_optional_time' , } , agg . getIndexPattern ( ) ) ; } ;