The all day events module works fine when you are using 24 hour format without jscalendar, storing the dates as YYYY-MM-DD 00:00:00 to YYYY-MM-DD 23:59:00.
With 12 hour format and no jscalendar, the time boxes do not show up (which is correct) but it stores YYYY-MM-DD 12:00:00 to YYYY-MM-DD 13:59:00 instead of YYYY-MM-DD 00:00:00 to YYYY-MM-DD 23:59:00, which loses the all day-ness.
With jscalendar (regardless of 12/24 hour setting), the pop up box defaults to the current time and it saves whatever time is in there to the database, esentially ignoring the checkbox for all day.
A possible solution would be to have another db field for "all day". If this is set, it ignores any times that might be with the dates when displaying. The only issue I can see with this is that the textbox on the entry form when using jscalendar would still show times, which may be confusing. Otherwise this could make things a lot simpler since we wouldn't be relying on the times being 00:00 to 23:59 to signify all day.
Michelle
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | fix12hr_event.patch | 362 bytes | michelle |
| #14 | fix12hr.patch | 1.83 KB | michelle |
Comments
Comment #1
snufkin commentedand it would also allow different theming for all-day events. im not sure i have time to do this right now because SoC is starting, but i will try to follow this issue.
Comment #2
michellePartially fixed. Thanks to Gurpartap giving me the syntax that hours of searching didn't yield, I changed this function in event_all_day.js and it now works with 12 hour clocks. This didn't fix the jscalendar issue, but I'm holding off on that because there's a question of what jscalendar is going to be used.
Michelle
Comment #3
nancydruFabulous! It doesn't fix the "Determine" function either, but that's very minor.
Comment #4
michelleHmm... Actually, not so minor. I went to fix the determine function and discovered another problem. When you enter an event and set it all day it converts it to 00:00 - 23:59 on save to the database, which is fine, so that all the other functions can tell that it's all day. But when you go to edit it, the conversion back to the 12 hour clock makes it 12:00-11:59 instead of 00:00-11:59 which is a problem when you go to save it again and also a problem for determining that it's an all day event. Looking into this more now.
Michelle
Comment #5
michelleOk, I should have waited a few minutes before posting. I figured it out right after.
Here's the event_all_day.js change:
I'm sure that could be compacted more since it duplicates most of the check but this was it's easy to see that we're doing things one way for 12 hour and another for 24 hour. For this to work, a change is needed in event.module:
I don't know why that was in there so I don't know what harm commenting it out may cause. So far, I don't see a problem. We need it to leave the start hour at 0 in order for all day to work properly. If there is a side effect of commenting this out, then hopefully it can be solved by an if test.
Michelle
Comment #6
michelleDon't use this latest code, yet... It causes problems with 12pm. Unfortunately my son woke up crabby from his nap so I have to get off the computer. I'll work in it more later.
Michelle
Comment #7
michelleActually, I don't think it's my code. I put the event module back to stock and it still chokes on 12 noon. So I guess I found another bug. AFAIK, my code is safe. If anyone discovers otherwise, please comment.
Michelle
Comment #8
nancydruHmm, I don't have that code in event.module.
Comment #9
michelleSetting this one as a "patch", too, even though it's not technically a patch. I don't want to mark them as fixed until the actual module code gets it.
Nancy: Are you using the latest dev snapshot? I don't know when the code got added.
Michelle
Comment #10
nancydruI'm using the May 2 code.
There is an error in your JS code. In 12 hr format, the start hour is 12, not 0.
Comment #11
michelleThat wasn't an error. The 0 instead of 12 is intentional and is the reason the event.module code that forces 0 to become 12 needs to be commented out. If you set it to 12:00am - 11:59 pm, the module does not recognize it as being an all day event. It needs to be 00:00am - 11:59pm which gets converted properly in the database to 00:00 - 23:59, which is what it needs to be in order to be considered an all day event.
By the way, May 2 code is pretty old. The latest dev snapshot, which is the code I'm testing against, was a couple days ago. I can't guarantee these changes will work against old code as I don't know what's all changed in V2 in the last month.
Michelle
Comment #12
nancydruHmm, it didn't work at all for me until I put the 12 in there. Now it works fine.
I'm using 5.x-1.x-dev, and the Update_status module says May 2 is the recommended version.
Comment #13
michelleNancy: Ah, that's the problem then. This issue is for 5.x-2.x as that's what I'm actively working on. 5.x-1.x uses an entirely different method of storing times. A method which doesn't work well, which is why it was re-written. Good that you found a solution that works for that version as I'm pushing to get V2 ready for release and just don't have the time to test backports to V1 as well.
Michelle
Comment #14
michelleOk, I tried my hand at making a patch. Hopefully I did it right.
Michelle
Comment #15
michelleAlso need the bit to comment out the auto changing of 0 to 12 in the event module.
Michelle
Comment #16
michelleWe now have a "has_time" field so the times being stored are now irrelevant. Marking this fixed.
Michelle
Comment #17
(not verified) commented