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

Datepicker UI becomes ambiguous when changing the date programmatically #858

Closed
lexmark-awilliams opened this issue Aug 18, 2016 · 2 comments

Comments

@lexmark-awilliams
Copy link

lexmark-awilliams commented Aug 18, 2016

If you change the bound date programmatically, the UI is very ambiguous about which date is selected.

screen shot 2016-08-18 at 1 33 46 pm

In this screenshot, the 19th is the selected date, the 20th is the last date the user has clicked on with the mouse, the 18th is the current date, and the month has been changed using the left and right arrows a few time such that the 1st appears 'pressed'. The currently selected date should be made visually distinct from all the other dates in some way, preferably with a css class that could be overwritten by apps using the datepicker component.

Example code to reproduce:

import { Component, OnInit } from '@angular/core';
import { FORM_DIRECTIVES } from '@angular/forms';
import { DATEPICKER_DIRECTIVES } from 'ng2-bootstrap/ng2-bootstrap';

@Component({
  selector: 'cui-example-broken-class',
  template: `
    <datepicker
          [(ngModel)]="exampleDate"
          [initDate]="exampleDate"
          [showWeeks]="false"
          minMode="day"
          maxMode="day"
          datepickerMode="day">
    </datepicker>
    <div>
    {{ exampleDate }}
    </div>
  `,
  directives: [DATEPICKER_DIRECTIVES, FORM_DIRECTIVES]
})
export class BrokenCssClassComponent implements OnInit {
  exampleDate: Date = new Date(2016, 4, 5);

  ngOnInit(): void {
    setTimeout(
        () => {
          this.exampleDate = new Date(2016, 4, 10);
        },
        5000);
  }
}

Remember to change the month a few times or you will not see the behavior I have described.

@Redlab1
Copy link

Redlab1 commented Aug 19, 2016

+1 Got the same problem in my component.

@kamikaze
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants