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

Times between 12:00AM-12:59AM save as PM when defaulted or typed in #7799

Closed
sabrina-stangler opened this issue Jun 10, 2019 · 4 comments
Closed
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@sabrina-stangler
Copy link

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

https://stackblitz.com/github/primefaces/primeng-issue-template

Current behavior
You type an AM time into the field after a PM time exists or no time is selected and the time in PM is maintained and saved.
You have a default time of 12:00AM and you select any date and the time saved is in PM
image

Expected behavior
You type an AM time into the field after a PM time exists or no time is selected and the AM time is maintained and saved.
You have a default time of 12:00AM and you select any date and the time saved is in AM

Minimal reproduction of the problem with instructions
Either

  • Prepare a defaultDate attribute with the time set to midnight (12:00AM) by using .setHours(0, 0, 0)
  • Open p-calendar and select any date
  • See that the time displayed in the text field is in PM time

OR

  • Open p-calendar and select any date
  • Select a time between 12:00AM and 12:59AM (using arrow selectors)
  • Click off calendar (at this point, you could save the form or whatever you'd like to get back to editing, or just simply click off)
  • Reopen calendar and select another date
  • See that the time displayed in the text field has changed to PM time

What is the motivation / use case for changing the behavior?
So that we can default a date to have a time of midnight that day if a time is not identified by the user

Please tell us about your environment:
Windows, IntelliJ, HTTP, p-calendar is in a drawer and within a form

  • Angular version: 6.0

  • PrimeNG version: 6.1

  • Browser: [ Chrome 75 ]

  • Language: [ TypeScript 3.2.4 ]

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

@mertsincan mertsincan self-assigned this Jun 19, 2019
@mertsincan mertsincan added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jun 19, 2019
@mertsincan mertsincan added this to the 8.0.1 milestone Jun 19, 2019
mertsincan added a commit that referenced this issue Jun 21, 2019
@yukelele
Copy link

@mertsincan Can this fix be applied for PrimeNg version 7.3.9? If so, when can it be done? We are using Angular 7 for our app.

@sabrina-stangler
Copy link
Author

@mertsincan We upgraded our app to the latest primeng and have found that the issue is still not resolved.

Is the scenario that is breaking here clear?

To be clear:

  • Create a date & time picker in 12 hour format
  • Use date & time picker in input field that displays dynamically (not a static calendar)
  • Open date & time picker in application
  • Select a time between 12:00AM-12:59AM
  • Click off calendar & see that the time displayed in the input field is in PM

Please let me know if you are not able to reproduce the issue.

@sabrina-stangler
Copy link
Author

sabrina-stangler commented Jul 17, 2019

After some further investigation, we see that the problem persists with TYPING in 12:00AM-12:59AM times, but it is fixed for the time selector in the popup.

My apologies for not clarifying that in my initial comment.

@sabrina-stangler
Copy link
Author

One of my colleagues is working on a PR of his own that we believe will resolve the typing problem.

RLijewski pushed a commit to RLijewski/primeng that referenced this issue Jul 17, 2019
cagataycivici added a commit that referenced this issue Sep 5, 2019
…1259AM-into-calendar-input-saves-as-PM

Fixed #7799 typing 1200AM to 1259AM into calendar input saves as PM
JacobSiegle pushed a commit to JacobSiegle/primeng that referenced this issue Oct 2, 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

4 participants