web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Binding to a date attr...
Power Apps
Answered

Binding to a date attribute

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi guys,

 

Can you give me an example manifest file for binding to a DateTime field?

 

I've tried the following manifest file and it comes up with compile error :
" [tsl] ERROR in C:\PCF_Controls\_PCF\CountDownTimer\CountDownTimer\index.ts(231,4)
TS2322: Type 'string' is not assignable to type 'Date | undefined'."

 

<?xml version="1.0" encoding="utf-8" ?>
<manifest>
 <control namespace="ControlsAndrewLy" constructor="CountDownTimer" version="0.0.1" display-name-key="Countdown Timer Control" 
 description-key="A simple countdown timer, takes a date as an input" control-type="standard">
 
 <!-- property node identifies a specific, configurable piece of data that the control expects from CDS -->
 <property name="inputDate" display-name-key="Input Date" description-key="Input Date to be used for the countdown timer."
 of-type="DateAndTime.DateOnly" usage="bound" required="true" />

 <resources>
 <code path="index.ts" order="1"/>
 
 <css path="css/CountDownTimer.css" order="1" />
 <!-- UNCOMMENT TO ADD MORE RESOURCES
 <resx path="strings/CountDownTimer.1033.resx" version="1.0.0" />
 -->
 </resources>
 </control>

Following the docs online

https://docs.microsoft.com/en-us/powerapps/developer/component-framework/manifest-schema-reference/property#remarks

 

I am using DateAndTime.DateOnly should be an acceptable parameter of of-type?

 

 

 

 

I have the same question (0)
  • Hemant Gaur Profile Picture
    Microsoft Employee on at

    this looks like the error when the value is used in the control implementation.

     

    this.context.parameters.inputDate.raw is the Date object and can be used as date.getTime() or toString();
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    You're right hemant.  Thanks for that again, fixed the reference in index.ts and that allows me to compile.

     

    Although, now i have another issue, i've tried using the control against the Date of Birth field on contact and the control isn't showing up (using same manifest as above).

     

    date_bound.PNG

     

     

     

  • Hemant Gaur Profile Picture
    Microsoft Employee on at

    Not sure what might be happening here, but can you try using type-group and declaring contol support for both date and dateAndTime. 

     

    See example below

     
    <type-group name="date">
     <type>DateAndTime.DateOnly</type>
     <type>DateAndTime.DateAndTime</type>
     </type-group>
     <property name="value" display-name-key="DateTimeControl" description-key="DateTimeControl description" of-type-group="date" usage="bound" required="true" hidden="true" />
     

     

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey Hemant, tried the above code within manifest.  Still no go either.. not showing up as selectable control for birthdate field.

     

     

     <!-- property node identifies a specific, configurable piece of data that the control expects from CDS -->
     <property name="inputDate" display-name-key="Input Date" description-key="Input Date to be used for the countdown timer."
     of-type-group="date" usage="bound" required="true" hidden="true" />
     
     <type-group name="date">
     <type>DateAndTime.DateOnly</type>
     <type>DateAndTime.DateAndTime</type>
     </type-group>
     

     

  • Hemant Gaur Profile Picture
    Microsoft Employee on at

    My Bad , please remove the following from xml.

    hidden="true" />

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Still same result.  Not showing up on date field.

     

    Want to try it out on your environment?

    https://1drv.ms/u/s!Ags-1oGgNllShd9ED5MirzwN4LIVQw?e=CbquI7

     

     

  • Verified answer
    jolake Profile Picture
    Microsoft Employee on at

    Hi Andrew,

    I was able to import your control as is without issue on my machine (see attached). It shows up in the list for a control of DateTime.DateAndTime type.

     

    I believe the issue may be that you have not updated the control version in the manifest when you made the change to remove the hidden="true" attribute on the property node, so those changes were not consumed when you imported the updated control manifest. The version in the solution you provided still shows 0.0.1, try re-importing after bumping that value and see if that fixes your issue.

    coutndown.png
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Ah, you're right, it was the version number.  Thought it would overwrite my customisations when I import.  Thanks for steering me in the right direction.

     

     

    btw, guys i'm putting together a tips and tricks article for people getting started in PCF development.  It's open source so if anyone has any tips they'd like to share to edit the following:

    https://github.com/365lyf/PCFControls/blob/master/README.md

     

     

     

     

  • Hemant Gaur Profile Picture
    Microsoft Employee on at

    Customizations are always maintained when the new control version is published however control should adhere to the properties declared. For example if the new version of the control removes a required property , import is blocked at that time because there isnt a way to determine how the already configured property can be handled. New properties however can be added to the control and configurations are maintained . For development workflow, if at any point the situation arises which is very much possible to change the properties or their types, you can remove the configuration and then uninstall the previous control version. 

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 633

#2
11manish Profile Picture

11manish 588

#3
Valantis Profile Picture

Valantis 457

Last 30 days Overall leaderboard