# 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:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjord](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@cjord](https://discuss.elastic.co/u/cjord)\
**Post date:** [June 23, 2021, 5:44am UTC](https://discuss.elastic.co/t/timefilter-in-custom-plugin/276720/1 "2021-06-23T05:44:46Z")

</div>

Is there any way to get the values of the time filter in a custom page on a plugin?

![Screenshot 2021-06-23 014107](https://us1.discourse-cdn.com/elastic/original/3X/e/3/e36f454cbb60260160ecd42f42e377e0552f21a2.png)

I would like to be able to read the values to display on the page as well as hook into the refresh event when the time filter is updated.

This is the closest reference I have been able to find and appears to be very out of date. [Get time from Time Range from custom plugin](https://discuss.elastic.co/t/get-time-from-time-range-from-custom-plugin/175800)

Thanks

---

<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>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 21, 2021, 10:42am UTC](https://discuss.elastic.co/t/timefilter-in-custom-plugin/276720/3 "2021-07-21T10:42:42Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
