twinssbc / Ionic2-Calendar

A calendar component based on Ionic framework
https://ionic-calendar-demo.stackblitz.io
MIT License
388 stars 197 forks source link

How to customize dynamically weekview hour range? #146

Closed ChrisK1994 closed 7 years ago

ChrisK1994 commented 7 years ago

The default hour range is from 12AM to 11PM, is there any way to customize this according to the hour of earliest and latest event?

twinssbc commented 7 years ago

@Astacius Do you mean you want to change the hour range based on the events in this week? What if there's no event in the current week? If you just want to change to a fixed range, you could set margin-top and height of weekview-normal-event-table like below. But it won't support set different range in each week.

.weekview-normal-event-table {
    margin-top: -100px;
  }

Or you could use scrollToHour option to scroll the view to a specific hour by default.

ChrisK1994 commented 7 years ago

Is there any way to set scrollToHour according to current week? Not only globally?

twinssbc commented 7 years ago

@Astacius Unfortunately scrollToHour is used during the weekview initialization phase. Once it's set, navigating between weeks always use the same value. You could use some low level DOM selection query to locate the list and scroll it to your desired position.