angular-mighty-datepicker icon indicating copy to clipboard operation
angular-mighty-datepicker copied to clipboard

Date range selection within a single calendar

Open spaceribs opened this issue 9 years ago • 5 comments

This is still being actively developed, but the idea is to be able to select a range of dates within a single calendar. It deals mainly with the selection logic and returns back a moment.range as a value to ng-model.

spaceribs avatar Feb 17 '16 19:02 spaceribs

@spaceribs looks nice

Jaspur avatar Feb 23 '16 18:02 Jaspur

I tested it and it seems to work fine.

jrencz avatar Mar 04 '16 11:03 jrencz

:+1:

aliibrahim avatar Mar 04 '16 11:03 aliibrahim

@spaceribs I think it's not possible to start with noting selected.

As I described in the comment on src/angular-mighty-datepicker.coffee:126 there's a condition that triggers an error because it is assumed model is DateRange object. I tried to work this around by passing an empty object (not a DateRange) as ngModel initially and the picker starts but it still has the current date selected although the internal $scope.model is in fact that empty object and it does not allow the anything to be selected (because of the assumption that modal is a valid range in lines 231, 232)

The condition with current day being selected despite the fact that model is neither a moment not a range is probably not caused by this particular PR. I'm testing the last commit of your fork's master but since there's no way to file an issue there I'll comment here. I think it's caused by lack of check if $scope.model is truthy here

jrencz avatar Mar 13 '16 10:03 jrencz

Another problem: When the default date is selected and previous month is requested then single date is moved to the same day (today: 13th) on the requested month. With range it works a bit different: by default I have Mar 13th-13th (1 day range) and when I go back to Feb the range becomes Feb 13th - Mar 13th.

It won't happen if range is manually selected (e.g. I select Mar 14th - 15th) and then month is changed it works fine.

jrencz avatar Mar 13 '16 11:03 jrencz