Primeng: p-calendar with range and readonlyInput=false

Created on 1 Dec 2018  路  5Comments  路  Source: primefaces/primeng

I'm submitting a ...

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

I found the bug here:
In calendar.ts/onUserInput() there is a call to this.isSelectable(value.getDate(), ...
But in case of selectionMode="range" value is an array -> causes an error when try to call value.getDate().

Plunkr Case (Bug Reports)
https://stackblitz.com/edit/github-fjpcup

Current behavior
not possible to edit a date-range via textfield

Expected behavior
like it was in primeng 6.X

Minimal reproduction of the problem with instructions
try to change the date-range via textfield here:
https://stackblitz.com/edit/github-fjpcup

  • Angular version: 7.X

  • PrimeNG version: 7.X

  • Browser: [all ]

  • Language: [all]

enhancement

Most helpful comment

I created PR for this bug #7580 :)

All 5 comments

I'm having the same problem, please fix...

We're having same issue. In docs range calendar has readonly input by default. If it is desired behaviour please secure it somehow because now it is throwing an error when calendar is using time picker additionaly.

This issue happens even in version 6.1.7.
Everythings works fine in version 6.1.4. I haven't tested versions between them.

vendor.js:61083 ERROR TypeError: Cannot read property '1' of null at Calendar.push../node_modules/primeng/components/calendar/calendar.js.Calendar.validateHour (vendor.js:102157) at Calendar.push../node_modules/primeng/components/calendar/calendar.js.Calendar.incrementHour (vendor.js:102079) at Calendar.push../node_modules/primeng/components/calendar/calendar.js.Calendar.repeat (vendor.js:102114) at Calendar.push../node_modules/primeng/components/calendar/calendar.js.Calendar.onTimePickerElementMouseDown (vendor.js:102094).

Steps to reproduce:

  1. Configure calendar selectionMode = 'range', readonlyInput = false, showTime = true
  2. Assign date range using date picker
  3. Change anything inside input using keyboard.
  4. Try to change the hour/minute value using time picker arrows.

I have the same problem. When typeing a range in a calendar, the whole input gets cleared
Please fix

Thx

The same problem i have

                   <p-calendar
                        id="calendar"
                        selectionMode="range"
                        showButtonBar="true"
                        pattern="MM-dd-yyyy"
                        [readonlyInput]="true"
                        [numberOfMonths]="3"
                        [placeholder]="rangeDates"
                        [(ngModel)]="rangeDates"
                        (ngModelChange)="calendarDatesChange($event)"
                        [showIcon]="true"
                    >

then i try edit manual by keyboard i have null value

I created PR for this bug #7580 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lilling picture lilling  路  3Comments

just-paja picture just-paja  路  3Comments

Helayxa picture Helayxa  路  3Comments

jisqaqov picture jisqaqov  路  3Comments

SchneMa picture SchneMa  路  3Comments