PHP Version 4.4.7
I am running Date 6.x-2.x-dev (2008-Nov-09) and using the "Text Field with Date Pop-up and Repeat Options" widget to add a date field to a "Program" content type to create program schedules for a community centre web site.
I am finding that the time field for the Repeat Until option isn't autofilling like the others ("Program Schedule From date" and "Program Schedule To date"). If you don't make an effort to click in the box and press an up or down arrow, then it is set to 12:00 AM by default. I found that fact was causing me to miss the last date upon submit. This was because though date was correct, the time ended up being before the last scheduled run time of the program.
Would it be possible to have the time automatically set to 11:59 PM by default? This makes the sense to me because most people probably would only be specifying for it to "Repeat Until" the last date on which the event would be running. This would make it work for an event set for any time on that last day.
Thanks
J
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | date-repeat-time-337666.patch | 544 bytes | aaronbauman |
Comments
Comment #1
FoolsRun commentedI'd like to add a vote for this --I'm having a lot of trouble because of this default.
Comment #2
akiosatoh commentedI would also like to request the default to be 11:59pm, so we never have to worry about accidentally omitting the last item of the repeated event.
Comment #3
winston commentedFirst time user - I hit this within 5 min. Definitely a wtf moment for the user. Will have a look at the code when I have a moment unless someone gets to it first.
Comment #4
FoolsRun commentedAww crap. I'd fixed this with some kind of hack, failed to document it, and then totally forgotten about it until now. That was many, many updates ago. If I figure out what I did, I'll post the workaround here.
Comment #5
FoolsRun commentedFound it!
This works in the current stable version of the module, but I see no reason why it wouldn't also work in the -dev version.
in date_repeat/date_repeat_form.inc, on line 63, find
date_timezone_set($until_date, timezone_open($timezone));Below it add:
Comment #6
karens commentedI committed something different -- I hid the time element in the input form and in the validation step I transform the time to 11:59:59. Let's see how that works.
Comment #8
jjwhitney commentedHi Karen,
Thanks so much for all your great modules! I hope I'm not missing something here, but your fix doesn't appear to work in the latest dev release. In date_repeat_calc.inc, function date_repeat_add_dates(), there's a difference between $end_date, and $rrule['UNTIL']['datetime'], and the former is used in a validity check:
I'm guessing that it would be fine if only the date was being compared, but the time is also included there. $end_date is always the very beginning of the date set in the "until" field, so unless the "from" field is 12am (the default for all-day events), the last repeating day will fail to be added.
Here are some test values that show the problem:
Please let me know if you need any more information. Thanks!
Comment #9
jjwhitney commentedOoops... Forgot to set this back to "active".
Comment #10
Renee S commentedConfirmed that this doesn't work - neither FoolsRun nor KarenS's fixes worked. It sees like it's just not seeing the last event, even when the UNTIL date is several days after when the actual last occurance should take place.
Comment #11
ianchan commentedsubscribe
Comment #12
mjoyce commentedHello. I solved the missing last date problem with this patch against the 6.x-2.x branch from Git. It does almost the same thing as #5 above, but in a slightly different place.
diff --git a/date_repeat/date_repeat_calc.inc
b/date_repeat/date_repeat_calc.inc
index e237e6d..1a4ce73 100644
--- a/date_repeat/date_repeat_calc.inc
+++ b/date_repeat/date_repeat_calc.inc
@@ -48,6 +48,7 @@ function _date_repeat_calc($rrule, $start,
$end, $exceptions, $timezone, $additi
// Create a date object for the start and end dates.
$start_date = date_make_date($start, $timezone);
$end_date = date_make_date($end, $timezone);
+ date_time_set($end_date, '23', '59', '59');
// If the rule has an UNTIL, see if that is earlier than the
end date.
if (!empty($rrule['UNTIL'])) {
Comment #13
Renee S commentedI can confirm that @mjoyce's fix worked (I'm at 2.7). Thanks =)
Comment #14
Renee S commentedComment #15
bredi commented#5 Hack worked for me. But I hope the correct fix can get committed.
thanks!
Comment #16
bredi commentedhmmm #5 worked on some nodes but not others. Possibly repeating "weekly" vs "daily" with an Advanced option to limit the Day? Not sure.. moved on to #12.
I then tried mjoyce #12 and this worked! Thank you.
In sites/all/modules/date/date_repeat/date_repeat_calc.inc
Around line 49 add the line - date_time_set($end_date, '23', '59', '59'); below.
// Create a date object for the start and end dates.
$start_date = date_make_date($start, $timezone);
$end_date = date_make_date($end, $timezone);
date_time_set($end_date, '23', '59', '59');
however... views that have "display repeat rule" on, displays the "Until" date one day after the stop date.
so a date that stops on Saturday, Jan 01, 2011 shows
"Repeats every week until Sunday, Jan 02 2011."
It should say "Repeats every week until Saturday, Jan 01 2011."
Thanks!
Comment #17
Renee S commentedbredi: you're seeing another bug, that one results in the "until" date getting pushed back a day every time you save.
Comment #18
aaronbaumanHere is #12 as a patch file for easier review.
Comment #19
davidhernandezI can confirm the patch in #18 works. I'm on the latest dev of 6.x-2.x.
Comment #20
hwasem commentedThanks for this fix. It worked great!
Reinette or bredi, can you elaborate on where I can find the fix for the bug you mention in #17? I'm hitting that problem too, and am having a hard time finding the solution. The only thing I find brings me back to this post. Thanks!
Comment #21
Renee S commented#1121278: Editing a repeating date sometimes advances the end date ... not much help, but maybe? :)
Comment #22
debo7debo commentedCan someone help fix 7.x of this issue please? Searched, and no one has a fix for this.
Comment #23
slcp commentedChanged version back 6.x-2.x-dev as the patches in the thread are developed using, and instructed to be applied to, this version.
Comment #24
gpk commentedThis has now been fixed for 7.x in #1267046: "repeat until ..." doesn't show the last repeat.
Marked #367907: Repeat Until rule missing last date, #1154580: Date Repeat Not Inclusive of "repeat until" date and #1063824: Repeat date saves a day later as duplicates.
Comment #25
gpk commentedClarify title.
I would add that in a previous version of Date I worked round the problem of the Until date being missed out of the set of repeating dates by setting the Time field of the Until date to 23:59. Now that the Until date has no time field this time component is being discarded; so while pre-existing events with repeating dates currently display OK, since the actual event dates are all stored in the database, if I go in and Edit an existing repeating event and Save without changing anything then the Until date is chopped off the repeat without warning.
Comment #26
slcp commentedAm I correct in understanding that there is no plan for time data to be stored for repeating dates at all?
I cannot find it right now (im on my phone) but what about the patch to make the time field available for repeating dates?
Comment #27
hwasem commentedWith the latest update to Date 2.8, I'm having this problem again. The last event is not being included if it is on the Until date. In addition, the repeating until date is displaying as a day later when the node is viewed, but upon editing, it is still the original until date.
Specifically, I have an event that repeats every Monday until 12/10/12 (which is a Monday). In the repeats tab, the last date of 12/10/12 is not listed. It appears to end at 12/3/12, which is incorrect. When I edit the event to confirm the Until date, it is still listed as 12/10/12.
I checked the content_field_date_start (that's the name of my CCK field) table for this event and the RRULE states "RRULE:FREQ=WEEKLY;INTERVAL=1;UNTIL=20121211T075959Z;WKST=SU". There is no record in the table for the 12/10/12 event.
When I view the event on the webpage with the repeat rule displaying, it shows it as ending 12/11/12.
Is anyone else having this problem return after updating to Date 2.8?
Comment #28
Renee S commentedThis has not been committed to Date yet despite being fixed in this issue for at least six months. I've set it to RTBC, perhaps that will help speed things along...
Comment #29
hwasem commentedHmmm...I'm still pretty new to Drupal and trying to figure out how patch implementation works. I made the change in the latest version (Date 6.x-2.8) so it shows the last event in the repeats tab.
+ date_time_set($end_date, '23', '59', '59');
to line 64.
Just in case someone else is in the same boat -trying to get Date 2.8 work show the last repeating event. Hopefully this is correct.
Comment #30
soulfroys#18 Works for me too! (last 6.x-2.x-dev - 2012-Mar-26)
Tks
Comment #31
karens commentedThe patch in #18 is not the best way to fix this. That forces every value that has a repeating date to be set to the last second of the day. That is going to break other things.
We need a fix like the D7 fix, that changes only this. I think we can use the D7 fix. Trying that out now.
Comment #32
Renee S commentedKarenS, as far as I can tell repeating events don't have a time, and that's the problem - the default time is 00:00:00 and the last date gets missed because that pertains to the UNTIL date as well.
It turns out, also, that GCal at least doesn't understand EXDATEs without a time specified (though it does understand RDATEs similarly specified), so that's something to keep in mind. The best way to fix this bug is to have time information for everything, to avoid the vagaries of client implementations. But barring that, this doesn't materially change how times are handled for repeating dates; but it does fix a bug.
Comment #33
karens commentedThe D7 version does have time and I'm trying to backport what I can of D7 to D6. Even if it doesn't break D6, this change would break D7 and I'm trying to get this part of the two versions in sync.
Comment #34
karens commentedOK, fixed here:
http://drupalcode.org/project/date.git/commit/1e7a957
Comment #35
gpk commentedMany thanks for this fix which reduces the number of patches I need to re-apply when upgrading!