Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Conversation

spaceribs
Copy link

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.

@Jaspur
Copy link
Contributor

Jaspur commented Feb 23, 2016

@spaceribs looks nice

@jrencz
Copy link

jrencz commented Mar 4, 2016

I tested it and it seems to work fine.

@aliibrahim
Copy link

👍

else
return false
when "range"
if $scope.model.start
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spaceribs you assume that model holds a valid range here.
It's possible to initialise the picker with empty date/range and this line causes an error

@jrencz
Copy link

jrencz commented Mar 13, 2016

@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
Copy link

jrencz commented Mar 13, 2016

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.

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

Successfully merging this pull request may close these issues.

4 participants