Skip to content

Commit

Permalink
fix(datepicker): fix nav to next month when today is 31 of month, and…
Browse files Browse the repository at this point in the history
… next month has only 30 days (#2557)
  • Loading branch information
valorkin authored Sep 1, 2017
1 parent 7cbb128 commit 2bcc1d2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/datepicker/reducer/bs-datepicker.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { flagYearsCalendar } from '../engine/flag-years-calendar';
import { BsViewNavigationEvent, DatepickerFormatOptions } from '../models/index';
import { isArray } from '../../bs-moment/utils/type-checks';
import { startOf } from '../../bs-moment/utils/start-end-of';

export function bsDatepickerReducer(state = initialDatepickerState, action: Action): BsDatepickerState {
switch (action.type) {
Expand All @@ -32,7 +33,7 @@ export function bsDatepickerReducer(state = initialDatepickerState, action: Acti
}

case(BsDatepickerActions.NAVIGATE_OFFSET): {
const date = shiftDate(state.view.date, action.payload);
const date = shiftDate(startOf(state.view.date, 'month'), action.payload);
const newState = {
view: {
mode: state.view.mode,
Expand Down

0 comments on commit 2bcc1d2

Please sign in to comment.