mattlewis92/angular-bootstrap-calendar

feature request: day-view-start/end changeable per binding

spotlight2001 opened this issue · 1 comments

Feature request:

i think it would be a good feature to be able to change between 24h/view and work hours.

like so:
calendarConfig.showTimesOnWeekView = true;
day-view-start="{{vm.dayViewStart}}"

but if i use this to swap alter the day-view-start the events are at the incorrect position regarding the times for the week view.

Link to minimally-working plunker that reproduces the issue

http://plnkr.co/edit/KvCr3CIPIfNlehfXITDl?p=preview

Versions

angular-bootstrap-calendar
0.29.2

Angular:
1.5.11

Calendar library:
?

Browser name and version:
chrome - Version 59.0.3071.115 (Official Build) (64-bit)
same on firefox

Thank you for providing plunker with example.

You can manually request the view to refresh:

vm.show24Hours = function() {
  vm.dayViewStart = '00:00';
  vm.dayViewEnd = '23:00';
  
  $timeout(rv);
};

vm.showOnlyWorkHours = function() {
  vm.dayViewStart = '08:00';
  vm.dayViewEnd = '20:00';
  
  $timeout(rv);
};

function rv() {
  $scope.$broadcast('calendar.refreshView');
}

Of course you will need to inject $timeout and $scope into your controller.

Plunker: http://plnkr.co/edit/brlQZ0HfXVendG5nr7OA?p=preview