makzumi / laravel-calendar

Flexible Calendar for Laravel 4
58 stars 31 forks source link

Enhancement: Option to control time increments #3

Closed rginnow closed 9 years ago

rginnow commented 10 years ago

I'd like to suggest the option of allowing the developer to choose how often to show events - 5, 10, 15, 20, 30, 1, or 2 hours - from the start time of day to end time.

Ex: $cal->setStartEndHours(7,21); $cal->setHowOften('+1 hour'); // could be '+5 minutes', '+30 minutes', etc.

makzumi commented 10 years ago

Hi,

Can you please elaborate a bit more on what you'd like? I dont quite understand.

Thanks!

**Edit: Do you mean, instead of fixed 30 minute intervals, have it so that the interval can be set manually?

rginnow commented 10 years ago

Well, currently a project I have (which your calendar has saved a LOT of time so thank you for this!) doesn't have the need for 30 minute intervals. I need 1 hour intervals, or increments.

Instead of seeing 9:00, 9:30, 10:00, etc. i want to just have 9:00, 10:00, 11:00, etc.

So attaching a $cal->setInterval() option would come in very handy!

To refresh on what I had mentioned before, the developer can then set the intervals in minutes or hours: $cal->setInterval('+5min');

or in my case: $cal->setInterval('+1hour');

makzumi commented 10 years ago

cool, glad it is saving you some time. Gonna take a look to see how hard it would be to implement this feature. Oh, please do a composer update, I updated a new version with a small bug fix.

rginnow commented 10 years ago

Awesome! Thanks for looking into it. And i'll do my update now :)

rginnow commented 10 years ago

@makzumi Ah I like the update! Much cleaner header now!

meltz commented 10 years ago

+1 to this. For now how can I manually edit this to show 1hr interval ?

I make the following changes to the code, hopefully is correct. $t < 2 to $t < 1 +30 minute to +1 hour

rginnow commented 10 years ago

@makzumi In reply to your edit, yes that's what I meant. Some people like the 30 minute increments, but others may want every 1 or 2 hours instead.

@meltz I haven't tried yet, but I'll look into trying that out myself.

rginnow commented 10 years ago

@meltz I tried what you suggested. it worked for both the day and week builds.

rginnow commented 9 years ago

I will be looking into making this a changeable variable like I suggested in the original post.

Donny5300 commented 9 years ago

This one is solved already