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 incorrect minutes validation #7232

Closed
polushinmk opened this issue Feb 12, 2019 · 1 comment
Closed

Calendar incorrect minutes validation #7232

polushinmk opened this issue Feb 12, 2019 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@polushinmk
Copy link
Contributor

polushinmk commented Feb 12, 2019

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

Plunkr Case (Bug Reports)

https://vbwilqlo.github.stackblitz.io

Current behavior

create p-calendar control with minDate and maxDate restrictions and in timeonly mode.
MaxDate (for example) setted as 4 hours and 0 minutes (04:00)
Click 4 times on hour increment arrow -> control shows 04:00
next click on minute decrement arrow -> control show 04:45

Expected behavior

while clicking on minute decrement arrow date not changed

Minimal reproduction of the problem with instructions

steps to reproduce in Current behaviour section
example:
https://vbwilqlo.github.stackblitz.io

problem on line

if (this.maxDate.getMinutes() < minute) {

may be it also affects seconds, not only minutes

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

bug
Please tell us about your environment:

Windows 10, VS Code, npm, ng serve

  • Angular version: 5.X

7.2

  • PrimeNG version: 5.X

7.0.5

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

all

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    TS 3
  • Node (for AoT issues): node --version =
@polushinmk polushinmk mentioned this issue Feb 12, 2019
@polushinmk
Copy link
Contributor Author

polushinmk commented Feb 15, 2019

Hi all! Any reaction?
I can give any additional info
small proof example:

<p-calendar [timeOnly]="true" [stepMinute]="15" [readonlyInput]="true" [(ngModel)]="duration" [minDate]="minDuration" [maxDate]="maxDuration"></p-calendar>
public minDuration: Date = new Date(0, 0, 0, 0, 15, 0, 0); // min allowed time is 0:15
public maxDuration: Date = new Date(0, 0, 0, 4, 0, 0, 0); // max allowed time is 4:00

First: choose max hour (in this example 4:00)
Second: click on minute decrement arrow (on increment all works fine, validation works correct)
Result: time will be 4:45 - invalid value

Also I made a PR #7233 which should fix this issue

@cagataycivici cagataycivici changed the title Bug: p-calendar incorrect minutes validation Calendar incorrect minutes validation Feb 28, 2019
@cagataycivici cagataycivici self-assigned this Feb 28, 2019
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Feb 28, 2019
@cagataycivici cagataycivici added this to the 7.1.0 milestone Feb 28, 2019
darkhelmet pushed a commit to weknowtraining/primeng that referenced this issue Mar 25, 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

2 participants