How to display the From and To dates on Tooltip from DATE range filter?

Hello All,

I have the requirement to display the selected DATE range filter values on data point tooltip (both from and to date)

Can someone give tips to get From and To dates on Tooltip from DATE range filter?

Thanks

Hello,

Assuming you’re using a range date/time filter connected to a date/time parameter value (and not a time hierarchy), then the underlying parameter value on the View Parameter will be a dundas.data.RangeDateTimeValue.

There are lots of examples on how to get values from a view parameter on our website.

The ‘From’ value will be in lowerBoundaryValue and the ‘To’ value in upperBoundaryValue, assuming discreet values have been set.

If tokens have been used instead and you want to display the actual date/time values from the tokens then you can use the resolvedParameterValue property to get the actual values.

If you’re instead using a control connected to a hierarchy, such as the calendar filter, then instead of a range date/time value you’d get a dundas.data.RangeMemberValue. Just like the date/time value the lower / upper boundary values will contain the ‘From’ and ‘To’ values, however in this case they will be a dundas.data.MemberValue which contains a memberTime property.

When you go to display these Date properties in JavaScript there’s some trickiness involved because of how JavaScript handles dates. I explained this in my comment here:

Once you have the date/time in the locale you want you can then either display it directly in a label, or use the available Globalize library in DBI to format the date however you want, such as Globalize.format(date, "F");

1 Like