How to set default value in Calendar

UI Components for React
Post Reply
Posts: 1
Joined: 10 Apr 2016, 17:47

17 Jun 2020, 15:54

I'm trying to put the default day into a Calendar component.
at the moment I set it fixed in the state:

Code: Select all

    this.state = {
            start: '18/06/2020'
        <Calendar id="data_inizio" showIcon={true} value={this.state.start} required
                                          onChange={(e) => this.setState({start: e.value, minDate: e.value})}
                                          dateFormat="dd/mm/yy" monthNavigator={true} yearNavigator={true}
                                          yearRange="2020:2030" touchUI={true}/>
but the Calendar is always empty.

Posts: 4638
Joined: 29 Jun 2013, 12:38

11 Oct 2020, 01:07


Sorry for the delayed response! Could you please try to add it as a Date object to value property?

Best Regards,

snake pliskin
Posts: 2
Joined: 17 Feb 2021, 15:14

17 Feb 2021, 15:18

Hi mert.sincan!

Please, example

snake pliskin
Posts: 2
Joined: 17 Feb 2021, 15:14

18 Feb 2021, 10:48

i solved the problem.
just need to initialize useState with a Date object.
as you said. thanks for the tip.

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests