Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
_os21
Frequent Visitor

Custom Visual - how to define formattingSettings.DatePicker in capabilities.json

I'm trying to use the date picker but cannot link the capabilities.json type to the Date type variable in the value, so even though I can select a date in the format pane, it won't save like other parameters.

 

In settings.ts the code is :

 

 

    payRefDate = new formattingSettings.DatePicker({
        placeholder: "Pay Period Reference Date",
        name: "payRefDate",
        displayName: "Pay period start",
        description: "Pay period seed reference date from which to start the repeating period",
        value: new Date(2023,0,1)  // this does not initialise the picker
    });

 

 

 

and the capabilities.json has (unsatisfactorily):

 

 

        "pay": {
            "properties": {
                "payRefDate": { 
                    "displayNameKey": "payRefDate",
                    "type": {"text": true}
                }
              }
            }

 

 

How do I access the extended ValueTypeDescriptor types in capabilites.json or is there a simpler way to get the date picker to work?

2 REPLIES 2
dm-p
Super User
Super User

Hi @_os21

This is an interesting one. I haven't tried it yet, but have had a look following your post, and have drawn the same conclusions as you, I think.

The permitted property types in capabilities.json are fairly primitive, and date is not a supported type in here. It's not possible to include conditional formatting measures that use the date or date/time data type either (just text or numeric).

You may be better contacting the team - pbicvsupport@microsoft.com - for clarification on whether this is actually supported, and if so, whether they have any guidance that they can offer on it.

Regards,

Daniel

 

P.S. here's my research, just to see if it lines up with yours:

  • With the new formatting cards (introduced in API 5.1), the data picker is not listed in the supported control types for property slices in the documentation, although there is a definition in the API for it.
  • Best I can tell is if you create a property with type "text", you can create a slice that utilises FormattingComponent.DatePicker, but it doesn't seem to work well, so I would assume that it's not yet fully supported. For example, this presents the date picker control:
    dmp_1-1673930605792.png
  • And this will store a value in the data view (but this is a stringified date/time), e.g.:
    dmp_2-1673930747383.png
  • However, this does not parse back when processing the settings, so it looks like the types are not compatible.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




_os21
Frequent Visitor

Thanks for this... the doc points one to the github so it's "sort of" documented! The whole formattingModel & PBIVIZ stuff is terribly documented... confused and inconsistent.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.