Minimum and maximum dates


#1

Hi, I need to know what is the minimum and maximum date of a time field in order to display it to users and to use that range in other libraries, is there a way to get that information in ChartFactor without creating a chart?


#2

Sure, you need to query time data, let me give you an example:

cf.provider('your_provider')
        .source('your_source')
        .timeField(cf.Attribute('your_time_field').func('DAY'))
        .set('timeRangeVisual', true)
        .element(timeId)
        .execute()
        .then(data => {
            const min = minMaxData.data[0].min;
            const max = minMaxData.data[0].max;
        });

Change the granularity according to what you need.


#3

Thanks a lot, i just tried and it works good