Skip to main content
Solved

Date in a selector to show month not just year

  • August 4, 2025
  • 2 replies
  • 28 views

danny.oneill

I have a date selector on a custom view: https://cityobservatory.birmingham.gov.uk/explore/dataset/percentage-universal-credit-claimants-in-employment-wmca-wards-2025/insight/ 

The date selector is based on the date field which is set to type of month. However its only showing years. How can I have this show months?

 

<div ods-facet-results="date" ods-facet-results-facet-name="date"
ods-facet-results-context="ctxfiltered" ods-facet-results-sort="-alphanum">
<ods-select
selected-values="ctxfiltered.parameters['refine.date']"
multiple="false"
options="date"
label-modifier="name"
value-modifier="name"
placeholder="Date">
</ods-select>
</div>

 

Best answer by Thomas R.

Hello Danny,

If you take date facets, they automatically start with year, and within the years they have facets for the months etc.

In order to do what you want you need to feed the select widget with an advance analysis result : 


<div ods-adv-analysis="dateSelector"
ods-adv-analysis-context="ctxfiltered"
ods-adv-analysis-group-by="date_format(date, 'YYYY/MM') as dateSelect"
ods-adv-analysis-order-by="-date"
ods-adv-analysis-limit="100">
<ods-select label-modifier="dateSelect" multiple="false" options="dateSelector" placeholder="Date" selected-values="ctxfiltered.parameters['refine.date']" value-modifier="dateSelect">
</ods-select>
</div>

 

If you need do do that again for another field I can recommend you using the API  console so you can build the list in any way you want and have immediate feedback on the request you want to create.

 

Best regards

2 replies

Thomas R.
Huwise Team
  • Huwise Team
  • 6 replies
  • Answer
  • August 5, 2025

Hello Danny,

If you take date facets, they automatically start with year, and within the years they have facets for the months etc.

In order to do what you want you need to feed the select widget with an advance analysis result : 


<div ods-adv-analysis="dateSelector"
ods-adv-analysis-context="ctxfiltered"
ods-adv-analysis-group-by="date_format(date, 'YYYY/MM') as dateSelect"
ods-adv-analysis-order-by="-date"
ods-adv-analysis-limit="100">
<ods-select label-modifier="dateSelect" multiple="false" options="dateSelector" placeholder="Date" selected-values="ctxfiltered.parameters['refine.date']" value-modifier="dateSelect">
</ods-select>
</div>

 

If you need do do that again for another field I can recommend you using the API  console so you can build the list in any way you want and have immediate feedback on the request you want to create.

 

Best regards


danny.oneill
  • Author
  • Guide
  • 14 replies
  • August 6, 2025

Thomas, always coming up with the goods! Worked beautifully