locked
SPFX DatePicker Question RRS feed

  • Question

  • Hi Experts,

    I want to build a DatePikcer in my SPFX Web Part.

    I searched the Google, all I found is third party control.

    Is there any SharePoint supported control ?

    Need a code demo for this.

    Thanks for any help.

    Monday, July 13, 2020 7:24 AM

Answers

  • Hi developer sp,

    You can use PnP DateTimePicker here:

    DateTimePicker control

    import { DateTimePicker, DateConvention, TimeConvention } from '@pnp/spfx-controls-react/lib/dateTimePicker';
    
    // Uncontrolled
    <DateTimePicker label="DateTime Picker - 12h"
                    dateConvention={DateConvention.DateTime}
                    timeConvention={TimeConvention.Hours12} />
    
    // Controlled
    <DateTimePicker label="DateTime Picker - 24h"
                    dateConvention={DateConvention.DateTime}
                    timeConvention={TimeConvention.Hours24}
                    value={this.state.date}
                    onChange={this.handleChange} />

    Thanks

    Best Regards


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    • Marked as answer by developer sp Tuesday, July 14, 2020 6:29 AM
    Tuesday, July 14, 2020 4:57 AM