Skip to content

Commit 8aea8ec

Browse files
committed
Move calendar view to next or previous month only if the selected date is outside the current view.
1 parent 98851b0 commit 8aea8ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/datetime-input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ directive('datetimeInput', ['$document', function ($document) {
3535
scope.setDate = function (date, calendar_update) {
3636
if ( scope.selected.isSame(date) ) { return; }
3737
scope.selected.year(date.year()).month(date.month()).date(date.date()).hours(date.hours()).minutes(date.minutes()).seconds(date.seconds());
38-
if ( scope.selected.clone().startOf('week').month() !== scope.calendar.month() || calendar_update ) {
38+
if ( (scope.selected.clone().startOf('week').month() !== scope.calendar.month() && scope.selected.clone().endOf('week').month() !== scope.calendar.month()) || calendar_update ) {
3939
scope.calendar = scope.selected.clone();
4040
}
4141
scope.handler();

0 commit comments

Comments
 (0)