# How to get Intents to send a Relative Timeframe from a Dashboard to my App

**URL:** <https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154>\
**Category:** Developer Q&A Forum\
**Tags:** intents, custom-app\
**Created:** [February 7, 2025, 12:50pm UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154 "2025-02-07T12:50:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![andycarlson](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andycarlson](https://community.dynatrace.com/u/andycarlson)\
**Post date:** [February 7, 2025, 12:50pm UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154/1 "2025-02-07T12:50:22Z")

</div>

Is there a way to invoke an intent from a dashboard so that my app receives the relative timeframe as… a relative timeframe?

In more detail…

I have an app that receives a timeframe via an intent. There is one required key field, with dt.timeframe being in the intent but non-required.

The intent can be triggered using ‘open with’ from a dashboard DQL table containing a column matching the name of the key field.

All of that works…

What is not so good is that if the dashboard has a Timeframe of, say, ‘now-30d’, when the intent is triggered it always seems to convert the begin and end values to absolute time values. The URL invoked contains the absolute times encoded as HTTP query parameters… I think this conversion happens before my app is involved in the process.

Is there a way to invoke an intent from a dashboard so that my app receives the relative timeframe as… a relative timeframe?

It seems to be possible for built-in DT things to do this when invoking each other.

Cheers.

---

<div class="post-metadata">

**Author:** ![haris](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/haris/32/38293_2.png) [@haris](https://community.dynatrace.com/u/haris)\
**Post date:** [March 12, 2025, 10:08am UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154/2 "2025-03-12T10:08:30Z")

</div>

Hi Andy,

can you please share your lastIntent from top context in custom app, following an example here:&nbsp;[Debug intents | Dynatrace Developer](https://developer.dynatrace.com/develop/intents/debug-intents/). Here we will be able to see the timeframe passed.

---

<div class="post-metadata">

**Author:** ![andycarlson](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andycarlson](https://community.dynatrace.com/u/andycarlson)\
**Post date:** [March 13, 2025, 4:11pm UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154/3 "2025-03-13T16:11:41Z")

</div>

This was passed when using ‘Open Field With’ from the legend of a bar chart on a dashboard. The timeframe on the dash was ‘last 10 minutes’… apart from not being passed as a relative value, it kinda looks like 11 minutes to me.

 ![forum-image.png](https://global.discourse-cdn.com/dynatrace/original/2X/e/e302244ae24cea7499923d65ee6bbecf698b6fc7.png)

---

<div class="post-metadata">

**Author:** ![haris](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/haris/32/38293_2.png) [@haris](https://community.dynatrace.com/u/haris)\
**Post date:** [March 17, 2025, 10:26am UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154/4 "2025-03-17T10:26:33Z")

</div>

Are you sure the time selector was set up as the last 10 minutes? Since the only way to get that kind of timeframe for me is to manually select that timeframe, otherwise object looks like this:

 ![haris_0-1742207187178.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/8/384132948c410e22a34965b21a3bfb542f1473ab.png)

---

<div class="post-metadata">

**Author:** ![andycarlson](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andycarlson](https://community.dynatrace.com/u/andycarlson)\
**Post date:** [March 21, 2025, 11:13am UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154/5 "2025-03-21T11:13:27Z")

</div>

Thanks for your reply. Yes I am sure

Dashboard screen grab…

 ![andycarlson_0-1742555392922.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/0/a0132f58fcf276a3ee501215ac232f63aa982f53.png)

lastIntent seen by the app…

 ![andycarlson_1-1742555565866.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/2/c22cce3501c90308ffa3bf3e13d5a5cc116bc5af.png)

---

<div class="post-metadata">

**Author:** ![andycarlson](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andycarlson](https://community.dynatrace.com/u/andycarlson)\
**Post date:** [March 21, 2025, 11:20am UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154/6 "2025-03-21T11:20:38Z")

</div>

Also the relevant part of the config showing the schema for the timeframe parameters (the app also allows timestamp… but that is not being used when drilling from a dashboard graph series)

 ![andycarlson_2-1742555999755.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/9/29100a85fe9edfad3a984e4dc6aaab9b3c34aa4c.png)

---

<div class="post-metadata">

**Author:** ![haris](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/haris/32/38293_2.png) [@haris](https://community.dynatrace.com/u/haris)\
**Post date:** [April 8, 2025, 12:50pm UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154/7 "2025-04-08T12:50:05Z")

</div>

Thanks for the details Andy, we’re checking this internally and as soon as I have info, I’ll share it with you.

---

<div class="post-metadata">

**Author:** ![dani\_coll](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dani_coll/32/33669_2.png) [@dani\_coll](https://community.dynatrace.com/u/dani_coll)\
**Post date:** [July 18, 2025, 12:54pm UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154/8 "2025-07-18T12:54:36Z")

</div>

Hi Andy! Apologies for the late reply,

I’ve been taking a look at your situation and as you said, whenever you open an intent from a chart legend, the intent contains the timestamp instead of the relative time.

For example:

```javascript
"timeframe": {
    "start": "2025-07-18T08:57:00.000000000+02:00",
    "end": "2025-07-18T09:28:00.000000000+02:00"
}

```

I’ve forwarded this concern internally and it’s expected behavior since we assume that you want to do a snapshot of the data whenever you do that.

If you want to get the relative timeframe you can open an intent of the whole chart

 ![dani_coll_0-1752842645581.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/5/25a74ca1211485e4b2e83e6abe1a296f3dba22aa.png)

Then, you will get the following timeframe

```javascript
"dt.timeframe": {
    "from": "now()-30m",
    "to": "now()"
},

```

Finally, you will have to filter yourself on your custom app the part of the chart that you need.

You are not the first user requesting this feature so if there is any update regarding this topic I’ll let you know

---

<div class="post-metadata">

**Author:** ![MostafaHussein](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mostafahussein/32/2785_2.png) [@MostafaHussein](https://community.dynatrace.com/u/MostafaHussein)\
**Post date:** [August 4, 2025, 10:49pm UTC](https://community.dynatrace.com/t/how-to-get-intents-to-send-a-relative-timeframe-from-a-dashboard-to-my-app/50154/9 "2025-08-04T22:49:53Z")

</div>

Hi Andy,

kindly check the below example mentioned in the docs to receive intent, i think it’s useful to know what is the available payload properties and i think you can convert it to relative time programmatically within your intent receiver function

```javascript
import React, { useEffect, useState } from 'react';
import { Code, Paragraph } from '@dynatrace/strato-components/typography';
import { getIntent, IntentPayload } from '@dynatrace-sdk/navigation';

export const YourComponent = () => {
  const [intentPayload, setIntentPayload] = useState<IntentPayload>();
  useEffect(() => {
    const intent = getIntent();
    if (intent) {
      setIntentPayload(intent.getPayload());
    }
  }, []);

  return (
    <>
      {intentPayload && (
        <Paragraph>
          Received Intent Payload <Code>{JSON.stringify(intentPayload)}</Code>.
        </Paragraph>
      )}
    </>
  );
};

```

if payload doesn’t include any indicator to relative timeframe you can suggest it as a product idea.

and kindly check this code block to convert it to relative timeframe

```javascript
const dateString = '2025-03-13T15:45:00.000Z';
const targetDate = new Date(dateString);
const now = new Date();

const diffMs = now - targetDate; // Difference in milliseconds

// Convert to days, hours, minutes, seconds
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
const diffHours = Math.floor((diffMs / (1000 * 60 * 60)) % 24);
const diffMinutes = Math.floor((diffMs / (1000 * 60)) % 60);
const diffSeconds = Math.floor((diffMs / 1000) % 60);
let timeIdentifier = diffDays > 0 ? 'd' : (diffHours > 0 ? 'h' : 'm');
let timeValue = timeIdentifier == 'd' ? diffDays : (timeIdentifier == 'h' ? diffHours : diffMinutes)
console.log(`-${timeValue}${timeIdentifier}`);

```

hope this useful for you.
