-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the features of When #2
Comments
I would like to see a more categorized and readable documentation for this library. It's really quite amazing - just took a good deal of digging to piece together what I needed. Can you put together just a list of all methods and uses in an easy to read format? |
Documentation is definitely in the works, been very busy the past few weeks. If there is anything specific you have questions about, feel free to send me a message. |
Hi, this looks like it's exactly what I was looking for! My question is, how would I use this to list "upcoming" events of a particular date range from DB entries? |
Hi Gospel Labs.. it sounds like you may not even need When to do what you're trying to do. I would store the date as a php timestamp in your db, for instance using php's time() function or the DateTime object to generate your timestamp. http://php.net/manual/en/function.time.php The timestamp will look something like 1324476804 (just an int), which you can perform basic math on to pull only upcoming events from your db, i.e. SELECT * FROM events_table WHERE event_date > " . time() . " Hope that helps! |
thanks for the quick reply. |
Hey again Gospel Labs. I did something similar and just stored the initial event date in the db dnd for the recurrence 'rule' I stored a serialized php array in the db which just had a field for the recurrence interval (weekly, monthly, yearly) and the number of times the event occurred (1, 2, 3, 4,...) So my array looked like: Array('interval' => 'weekly', 'occurrence' => 4) Then I would pull that event record from the db, and with When just plugged in the event start date, the interval, and the occurrence which generated an array of all the future event timestamps that I used to output to the end-user. |
Awesome, I will try to sort that out and put it to code. Thanks! |
quick question: would I be able to pull a list of events using this method (like all upcoming events this week, or the next 10 upcoming events) |
That's the one downside I've found to storing only the initial timestamp, is that you can't just do a sql query to pull the future events. You would have to pull the initial event, generate the recurrences, and with php only output the future events. I was creating a calendar, so I wanted ALL the events, not just upcoming. So I would pull all the events, generate their recurrences, and output them. You could go either route, though sounds like it may be better for you to store all the recurrences instead of just the initial one. |
Create documentation of the current capabilities and limitations.
The text was updated successfully, but these errors were encountered: