How to set initial data in range calendar

UI Components for Angular
Post Reply
Postdata
Posts: 3
Joined: 03 Mar 2017, 15:54

22 Feb 2019, 11:11

Is it possible to set default data in range calendar?
We have p-calendar with rande mode.

Defined as below:

Code: Select all

<p-calendar selectionMode="range" showButtonBar="true" [showIcon]="true" [defaultDate]="initTransactionDate"
                  [monthNavigator]="true" [yearNavigator]="true" yearRange="1900:2100"
                  formControlName="TransactionDateRange" dateFormat="dd.mm.yy" [locale]="defaultLocale" id="calendarRegistrationDate"></p-calendar>
as you can see we are using reactive form.

we want to set initial data

Code: Select all

 this.fb.group({TransactionDateRange: ["2019-02-11T23:00:00.000Z", "2019-02-12T23:00:00.000Z"]});
and this is not working,

we also try to parse string as data:

Code: Select all

 this.fb.group({TransactionDateRange: Tue Feb 12 2019 00:00:00 GMT+0100, Wed Feb 13 2019 00:00:00 GMT+0100]});
but this does not show range value in control. We have the same problem with multi select control.

Could you tell me how to set date range programmatically during initializing reactive form?

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests