Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar: rselectionMode range + showTime doesn't work together #15655

Open
Emiliorth opened this issue May 22, 2024 · 1 comment
Open

Calendar: rselectionMode range + showTime doesn't work together #15655

Emiliorth opened this issue May 22, 2024 · 1 comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Milestone

Comments

@Emiliorth
Copy link

Emiliorth commented May 22, 2024

Describe the bug

p-calendar with selectionMode="range" and [showTime]="true" gives error, when clicking arrows that changes hours
image

Environment

Windows 10 Angular 17, PrimeNG 17.17.0

Reproducer

No response

Angular version

17.3.0

PrimeNG version

17.17.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

21.6.0

Browser(s)

Chrome

Steps to reproduce the behavior

Click on arrow that changes hours
<p-calendar [formControlName]="controlName" [inputId]="finalInputId" appendTo="body" [dateFormat]="'dd-mm-yy'" [showIcon]="true" [showClear]="true" [showButtonBar]="true" [showTime]="true" [minDate]="min" [maxDate]="max" selectionMode="range" [required]="requiredAutoForValidation"> <ng-template pTemplate="triggericon"> <app-google-icon [icon]="GoogleIcon.CALENDAR_TODAY"></app-google-icon> </ng-template> </p-calendar>

Expected behavior

No response

@Emiliorth Emiliorth added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 22, 2024
@matteobertozzi
Copy link

matteobertozzi commented Nov 29, 2024

Same problem with 18.0.0-rc.2 and 17.18.12

ERROR TypeError: value.toDateString is not a function
    at _Calendar.toggleAMPMIfNotMinDate (primeng-calendar.mjs:3895:43)
    at _Calendar.incrementHour (primeng-calendar.mjs:3889:10)
    at _Calendar.repeat (primeng-calendar.mjs:3930:35)
    at _Calendar.onTimePickerElementMouseDown (primeng-calendar.mjs:3905:12)
    at Calendar_div_3_div_5_Template_p_button_mousedown_2_listener (primeng-calendar.mjs:1576:36)
    at executeListenerWithErrorHandling (core.mjs:25797:12)
    at wrapListenerIn_markDirtyAndPreventDefault (core.mjs:25829:18)
    at HTMLElement.<anonymous> (platform-browser.mjs:745:112)
    at _ZoneDelegate.invokeTask (zone.js:402:33)
    at core.mjs:6717:49
<p-calendar [(ngModel)]="rangeDates" selectionMode="range"
  [readonlyInput]="true" inputId="range" [showTime]="true" />

at some point this code as removed from calendar.ts, so value now for ranges is an array and value.value.toDateString() is not a function

toggleAMPMIfNotMinDate(newPM: boolean) {
        ...

        if ((this.selectionMode == 'range' || this.selectionMode == 'multiple') && Array.isArray(value) && value.length > 0) {
            value = value[value.length - 1];
        }

@mertsincan mertsincan added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 16, 2024
@mertsincan mertsincan added this to the 18.0.1 milestone Dec 16, 2024
@github-project-automation github-project-automation bot moved this to Review in PrimeNG Dec 16, 2024
@mehmetcetin01140 mehmetcetin01140 modified the milestones: 18.0.1, 19.0.1 Dec 17, 2024
@mertsincan mertsincan modified the milestones: 19.0.1, 19.0.2 Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Projects
Status: Review
Development

No branches or pull requests

4 participants