Primeng: Add hideOnDateTimeSelect property to Calendar

Created on 21 Dec 2017  路  8Comments  路  Source: primefaces/primeng

There is no guarantee in receiving a response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeNG PRO Support where support is provided within 4 business hours

I'm submitting a ... (check one with "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

Current behavior
when select a date with time, the calendar does not close. It close if don't use the time.

Expected behavior
The calendar should close after select a date with time

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Angular version: 5.1.0

  • PrimeNG version: 5.0.2

  • Browser: [all | Chrome 63.0.32| Firefox XX | IE 11 | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

new feature

Most helpful comment

I can confirm this is not working properly. Same env.

Minimal reproduction of the problem with instructions
<p-calendar [(ngModel)]="test" [showTime]="true"></p-calendar>

Its esp. annoying in filters where you have to click outside calendar to trigger filtering.

All 8 comments

I can confirm this is not working properly. Same env.

Minimal reproduction of the problem with instructions
<p-calendar [(ngModel)]="test" [showTime]="true"></p-calendar>

Its esp. annoying in filters where you have to click outside calendar to trigger filtering.

Any one found the solution ?

It's so programmed:

 if(!this.showTime && this.isSingleSelection()) {
            this.overlayVisible = false;
 }

It's so programmed. This type of implementation makes sense, otherwise the calendar would close without entering the time. I would like to have a setting for a forced close with choosing the Date - in a case of a calendar with time.

I agree with hugograf. Additional setting is required.

In version 4.2.2 calendar is closed after date select.
Version 5 of primeNg introduce significant default behaviour (keep calendar open) without any possibilities of restoring previous behaviour.

fast workaround for component which contains a calendar:

@ViewChild(Calendar) calendar: Calendar;
private calendarOnDateSelectHandler: (event: any, dateMeta: any) => void
ngOnInit() {
        this.calendarOnDateSelectHandler = this.calendar.onDateSelect;
        this.calendar.onDateSelect = ((event: any, dateMeta: any) => { this.onDateSelectExtention(event, dateMeta); });
    }
private onDateSelectExtention(event: any, dateMeta: any): void {
        this.calendarOnDateSelectHandler.call(this.calendar, event, dateMeta);
        if (this.calendar.isSingleSelection()) {
            this.calendar.overlayVisible = false;
        }
    }

Any response to this? Need to be able to either close afer date selection even w/ showTime=true OR add a 'set' or 'ok' button to the button bar. Have this hide the overlay.

Added hideOnDateTimeSelect to make this customizable due to demand.

using of multiple using on select the calendar is not closing by raising event "this.calendar.overlayVisible=false;"

Was this page helpful?
0 / 5 - 0 ratings