Forum Discussion
Display a RefinableDate as Slider Refiner
- Jan 03, 2017
Something has changed in the search.clientcontrols.js script. Before the RefinableDate managed properties were mapped as DateTime (which is now changed to ECMADATE). Now with the script update, they are mapped as EcmaDateRefinersInvariant which does not contain the date range labels.
As an example, I added the same date ranges also for the EcmaDateRefinersInvariant type:
Which renders this result:
The *bug* in the code is that the SearchType for the ECMADATE type is overwritten, first when they set the EcmaDateRefinersSingle and after that by EcmaDateRefinersInvariant. So when you use a RefinableDate or auto-created managed property (one with an OWSDATE suffix), it will always return as an EcmaDateRefinersInvariant type. Which does not contain date labels.
So IMO there are two solutions, adding the labels also for the EcmaDateRefinersSingle and EcmaDateRefinersInvariant types. Or changing the order of the registration, so that EcmaDate is registered last:
As a workaround, I have added a temporary template with fixes the issue. You can find it in the GitHub repository: https://github.com/SPCSR/DisplayTemplates/tree/master/Search%20Display%20Templates/Refiners/Slide%20bar%20graph%20for%20custom%20managed%20properties
I have noticed this on at least 4 different tenancies which previously were exhibiting the correct behaviour for a Date/Time refiner based on a RefinableDatexx managed property.
- Rémy BosmanDec 08, 2016Brass Contributor
So most likely Microsoft has made some changes that caused this behaviour...
Now, I can either raise a service request, or find a workaround/fix. If anyone has an idea how to work around this issue, please share!
- Elio StruyfJan 03, 2017Copper Contributor
Something has changed in the search.clientcontrols.js script. Before the RefinableDate managed properties were mapped as DateTime (which is now changed to ECMADATE). Now with the script update, they are mapped as EcmaDateRefinersInvariant which does not contain the date range labels.
As an example, I added the same date ranges also for the EcmaDateRefinersInvariant type:
Which renders this result:
The *bug* in the code is that the SearchType for the ECMADATE type is overwritten, first when they set the EcmaDateRefinersSingle and after that by EcmaDateRefinersInvariant. So when you use a RefinableDate or auto-created managed property (one with an OWSDATE suffix), it will always return as an EcmaDateRefinersInvariant type. Which does not contain date labels.
So IMO there are two solutions, adding the labels also for the EcmaDateRefinersSingle and EcmaDateRefinersInvariant types. Or changing the order of the registration, so that EcmaDate is registered last:
As a workaround, I have added a temporary template with fixes the issue. You can find it in the GitHub repository: https://github.com/SPCSR/DisplayTemplates/tree/master/Search%20Display%20Templates/Refiners/Slide%20bar%20graph%20for%20custom%20managed%20properties
- Rémy BosmanJan 04, 2017Brass Contributor
Many Thanks Elio! I will pass this throught to Microsoft.
For now your workaround works perfectly.