Events Made Easy › Forums › Bug fixed or feature request implemented › Recurring – dates and time
Tagged: Date, recurrence, recurring, time
- This topic has 17 replies, 2 voices, and was last updated 13 years, 9 months ago by Franky.
-
AuthorPosts
-
Sun 6 Mar 2011 at 15:33 #42611AnonymousInactive
I’m not sure if this should be posted as a bug or feature recuest, so it goes as a feature request:
Recurring event with a end time that is less than start time, shows start and end date as the same.
My suggestion is to increment the end date by one, if the end time is less than the start time.
Best/
Andy
Sun 6 Mar 2011 at 18:41 #47106FrankyKeymasterNot a bug, but by design. But anyway: for events in recurrence, start and end date are always the same. For the recurrence itself: you need to give the correct end date then 🙂
Sun 6 Mar 2011 at 19:07 #47107AnonymousInactiveIf I have a weekly recurrence from, let’s say, 2011-03-09 to 2011-04-30 with time set to 22:00 – 01:00 …all the events duration will be -21 hours.
Is that by design?
Sun 6 Mar 2011 at 19:56 #47108FrankyKeymasterWell, it is by design, see in eme_recurrence.php, function eme_insert_events_for_recurrence:
$event = $event;
This is of course not the correct behaviour in your case, but it has been like even before I forked from the original plugin. But I got your explanation a bit wrong here, so let me code up the “+1” day if the end time is lower than the start time (I got it wrong with start/end date/time explanation)
Sun 6 Mar 2011 at 20:01 #47109FrankyKeymasterok, coded in trunk. Can you check this out:
Sun 6 Mar 2011 at 20:21 #47110AnonymousInactiveAh great! This also fixes an issue with taking an event out of recurrence …it made end-datetime = start-datetime, if end-time < start-time.
Great!
Actually …this could be implemented for single events as well …as it would be a common problem in other situations, due to userinput.
Thanks!
Andy
Sun 6 Mar 2011 at 21:36 #47111FrankyKeymasterSun 6 Mar 2011 at 21:44 #47112AnonymousInactiveYou are FAST!
Sun 6 Mar 2011 at 22:09 #47113FrankyKeymasterSometimes I am 🙂 Sometimes I am incredibly slow 😉
Sun 6 Mar 2011 at 22:20 #47114AnonymousInactiveHaha …yes …me too 😉
Thu 10 Mar 2011 at 07:49 #47115AnonymousInactiveOk …still not working 100% …one thing is missing.
Tjeck end-day first (if left blank) then set it to start-day. Then ad one day to end-day if end-day = start-day and end-time < start-time.
E.g.:
// This one is missing (if left blank, or error in input)!!
if ($event < $event) {
$event = $event;
}
if ($event = $event && $event < $event) {
$event = date(“Y-m-d”, strtotime(str$event)+86400);
}
Thu 10 Mar 2011 at 10:07 #47116FrankyKeymasterAnd what about this:
if ($endstring<$startstring) {
$event['event_end_date']=date("Y-m-d",strtotime($event['event_start_date'])+86400);
}==> don’t check for smaller than or equal for dates, it’s the endstring/startstring that matters.
Thu 10 Mar 2011 at 10:16 #47117FrankyKeymasterTry this change:
Thu 10 Mar 2011 at 10:23 #47118AnonymousInactiveWell …the thing is …there is a difference …tjecking the day and correcting that, before doing the over-midnight fix is key.
The end day might be ‘1700-01-01’ if not filled out …making it at least the same as the start day, is first.
Then …the fix you made above.
Thu 10 Mar 2011 at 10:36 #47119AnonymousInactiveAn example of userinput for a single-day event that spans midnight:
start-day: 2011-01-01
end-day: none
start-time: 22:00
end-time: 01:00
startstring: 2011-01-01 22:00
endstring: 1700-01-01 01:00
If the day-fix is not applied first, the result will be:
startstring: 2011-01-01 22:00
endstring: 1700-01-02 01:00
The day-fix does this:
startstring: 2011-01-01 22:00
endstring: 2011-01-01 01:00
The over-midnight-fix does this:
startstring: 2011-01-01 22:00
endstring: 2011-01-02 01:00
So, first day-fix, then over-midnight-fix
//day-fix:
if ($event < $event) {
$event = $event;
}
//over-midnight-fix
if ($endstring<$startstring) {
$event=date(“Y-m-d”,strtotime($event)+86400);
}
Thu 10 Mar 2011 at 10:43 #47120AnonymousInactiveYes! That’s the one! I implemented it, and it works!
Thu 10 Mar 2011 at 11:13 #47121AnonymousInactiveStill needs to be updated in eme_recurrence.php 🙂
Thu 10 Mar 2011 at 12:34 #47122FrankyKeymasterI changed it like that (it is what I intended)
-
AuthorPosts
- The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.