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

Potential calendar time dateFormat bug #2244

Closed
benjamincharity opened this issue Mar 8, 2017 · 2 comments
Closed

Potential calendar time dateFormat bug #2244

benjamincharity opened this issue Mar 8, 2017 · 2 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@benjamincharity
Copy link
Contributor

benjamincharity commented Mar 8, 2017

I'm submitting a ...

[x] bug report

Plunkr Case (Bug Reports)

Here is an example of the issue: http://plnkr.co/edit/Vf8t96?p=preview On load the hour is 13 but clicking the up arrow changes is to 2.

Current behavior
If hourFormat is set to 12 and the default time is past 12pm, the time shows as a 24hr clock until the first interaction. When changing the hour, it immediately switches to 12hr format.

ngprime calendar bug

Expected behavior

On initial load, it should show 1pm if it is 1pm (rather than 13:00)

It seems the issue is a triple equals where there should be a double equals on line 799 (486 of compiled code):

if (this.hourFormat === '12') { should be if (this.hourFormat == '12') {

Minimal reproduction of the problem with instructions

  • set hourFormat to 12
  • set defaultDate to any time past 12pm
  • set showTime to true
  • view the calendar

http://plnkr.co/edit/Vf8t96?p=preview

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

So that it doesn't jump between 24 and 12 hour clocks.

Please tell us about your environment:

@angular/cli: 1.0.0-beta.32
node: 6.9.5
os: darwin x64

  • Angular version: 2.0.X

@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-beta.32
@angular/compiler-cli: 2.4.9

  • PrimeNG version: 2.0.X

ngprime: 2.0.2

  • Browser: all

  • Language: all


Note: The first plunker that the 'new issue notes' points to is broken: This boilerplate plunker is currently broken: http://plnkr.co/edit/D1AK7i

@benjamincharity
Copy link
Contributor Author

Pull request here: #2245

@cagataycivici cagataycivici self-assigned this Mar 22, 2017
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Mar 22, 2017
@cagataycivici cagataycivici added this to the 4.0.RC2 milestone Mar 22, 2017
@cagataycivici
Copy link
Member

cagataycivici commented Mar 22, 2017

Merged in, thanks. You can also use;

hourFormat="12"

To support both, your PR helps for sure.

@cagataycivici cagataycivici changed the title Calendar time dateFormat bug Potential calendar time dateFormat bug Mar 22, 2017
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