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 - Unexpected behaviour when date format contains whitespace characters and showTime is enabled #6521

Closed
anett85 opened this issue Sep 19, 2018 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@anett85
Copy link

anett85 commented Sep 19, 2018

I'm submitting a ... (check one with "x")

[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 the date format contains whitespace characters, changing the text in the input clears the value of the input. This happens only when "showTime" is true.

Expected behavior
The text won't be cleared if the date format contains whitespace characters.

Minimal reproduction of the problem with instructions
STEPS TO REPRODUCE
Pre-action: Set this format for p-calendar: M dd, y (Sep 19, 18) .

  1. Select a date from the date picker.
  2. Click into the input, and modify the day to a valid value (e.g.: Sep 19 to Sep 18) and close the date picker.
    Actual result: The input is cleared.

I found the reason in your source code in calendar.ts#parseDateTime:
This is the point where you should modify the code:
let parts: string[] = text.split(' ');
In my case, parseDate method gets only 'Sep' in the first parameter (this.parseDate(parts[0], this.dateFormat)).

  • Angular version: 6.0.7

  • PrimeNG version: 6.0.0

@vinlos
Copy link

vinlos commented Jun 7, 2019

I provided the fix in the attached pull request and I was able to reproduce it on stackblitz

@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jul 8, 2019
@cagataycivici cagataycivici added this to the 8.0.2 milestone Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

5 participants