# TimeFilter in Custom Plugin

**URL:** <https://discuss.elastic.co/t/timefilter-in-custom-plugin/276720>\
**Category:** Kibana\
**Created:** [June 23, 2021, 5:44am UTC](https://discuss.elastic.co/t/timefilter-in-custom-plugin/276720 "2021-06-23T05:44:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)\
**Post date:** [June 23, 2021, 10:41am UTC](https://discuss.elastic.co/t/timefilter-in-custom-plugin/276720/2 "2021-06-23T10:41:44Z")

</div>

Hi @cjord!

You need to use data plugin. It will be available on time filter services:  
Something like: `data.query.timefilter.timefilter.getTime()`

> [@Applying global Time filter within a visualization to other dates](https://discuss.elastic.co/t/applying-global-time-filter-within-a-visualization-to-other-dates/273248/2):
>
> Hi @Thomas_Pierrot, welcome to the community wave You can get current global time range from time filter service in data plugin: Then you can use it to build your custom range filter

And this is how it used in one of our developer examples plugins:

> <https://github.com/elastic/kibana/blob/0477c4dae41daf75fd2dcfc98ced09458d0f1bbf/examples/search_examples/public/search_sessions/app.tsx#L145>

---

_[View the full topic](https://discuss.elastic.co/t/timefilter-in-custom-plugin/276720)._
