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

feat(datepicker): keep day/month when adding/removing month/year in ngb-calendar #1277

Closed

Commits on Jan 31, 2017

  1. feat(datepicker): keep day/month when adding/removing month/year in n…

    …gb-calendar
    
    BREAKING CHANGES: ngb-calendar getNext/getPrev specifications changed
    
    `calendar.getNext()`/`calendar.getPrev()` with the period parameter set
    as `'m'`/`'y'` no longer automatically returns the first day of the
    month / the first day of the year. The day in the month and the month in
    the year of the input date are now kept as much as possible.
    In case the destination month is is not long enough to contain a day with
    the same number, the last day of the month is used.
    
    For example:
    
    `calendar.getNext(new NgbDate(2016, 7, 22), 'm'))`
     previously returned: `new NgbDate(2016, 8, 1))`
      and now it returns: `new NgbDate(2016, 8, 22))`
    
    `calendar.getNext(new NgbDate(2016, 7, 22), 'y'))`
     previously returned: `new NgbDate(2017, 1, 1))`
      and now it returns: `new NgbDate(2017, 7, 22))`
    
    `calendar.getNext(new NgbDate(2016, 1, 30), 'm'))`
     previously returned: `new NgbDate(2016, 2, 1))`
      and now it returns: `new NgbDate(2016, 2, 29))`
     (because 2016-02-30 is not a valid date)
    divdavem committed Jan 31, 2017
    Configuration menu
    Copy the full SHA
    578edb5 View commit details
    Browse the repository at this point in the history