Problem/Motivation
If non-english language is selected on site, recurring events where a PM starting time is set are generated with incorrect AM starting time.
Steps to reproduce
- Install Drupal 9.1.0. and this module (base module only)
- Add a second language (Hungarian in my case, but I guess any country that uses 24-hour time format does the same)
- Select second language for UI
- Add weekly recurring event with PM starting time
- See event instances being generated with the same time, only AM
For example, If 5 PM start time and 3 hour duration is set, the event instances are generated with 5 AM - 8 AM.
- Switch back to English language
- Create other recurring event or edit same recurring event with PM starting time
- Event instances are generated correctly
Proposed resolution
No idea, sorry. Must be something with date formats.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | recurring_events-timezone_PM_bug-3190077-12.patch | 648 bytes | owenbush |
Comments
Comment #2
dr. gubó commentedComment #3
owenbush commentedThanks for raising this issue. Are you able to confirm if this is happening only for PM -> AM, or does it happen AM -> PM too? If you have access to the database, can you tell if the dates are being stored correctly in the eventinstance_field_data table in the date__value and date__end_value fields (these dates will be stored as UTC)? I am wondering if this is a display issue or an underlying data issue.
I can try and investigate this myself too, so thanks for the steps to reproduce.
Comment #4
dr. gubó commentedI can confirm it doesn't happen AM -> PM direction, events starting wit AM time seem to work just fine.
One important thing: this ONLY happens when I create an event series, and the event istances are generated. If I edit any individual event instance after that, it works fine, PM time stays PM time.
Looks like the event istance generation logic somehow misinterprets the value I enter as event start time in the recur widget. Maybe interprets it as 24-hour timestamp, while the logic passes a 12-hour timestamp and the AM/PM part is ignored somehow? (Just poking around, my backend/php skills are very limited, sorry.)
I had some issues with timezones messing up event start and end date displays, but that's another story I think. The raw stored values were stored properly as UTC, I checked that. I had to use Smart date module to make my start and end dates always display in with proper time zone. ({{ date__value__value }} tokens always seemed to display in UTC, while without a field rewrite the time zone was proper.)
Thanks for the quickness!
Comment #5
owenbush commentedSo far I have been unable to recreate this issue, but I have been using D8.9.11, not 9.1 as I have been testing on simplytest.me. I'll see if I can spin up a 9.1 site too, but here is what I did:
All the instances had the correct date/time on the Event Series page, Event Instance page and the Event Instance listing page.
I then tried configuring Hungarian as the default language and tried it all again, but it all seemed to work fine there too. I'll report back after I get a 9.1 instance running.
Comment #6
owenbush commentedI managed to get set up with 9.1 and I am still not able to recreate this issue. It might need a screencast or screenshots or something set up to help us figure this out.
Comment #7
dr. gubó commented@owenbush daily recurring events worked fine, I only had the problem with weekly events. Sorry for not clarifying.
Please check if you can replicate the issue with weekly events.
Comment #8
owenbush commentedI'm afraid I am still unable to recreate this even with a Weekly event. I just set up a weekly event between Jan 1th 2021 and Jan 30th 2021, to take place on Saturdays at 5:00PM and lasting 3 hours, and it created all the events at 5PM.
So now I am wondering if this is some issue with timezones. Can you let me know the following:
1. What timezone is your site configured in? You can find this in:
/admin/config/regional/settings2. What timezone are you physically located in?
3. Have you configured a timezone for your particular user account? You can view this by editing your user account
/user/[your-user-id]/editComment #9
dr. gubó commentedSorry for sleeping on this.
1. Site time zone is Budapest. Users are not allowed to set their own timezone.
2. I'm also in the same time zone phisically. (So are all users.)
3. Don't have any other account than /user/1 yet. If I enable user time zone configuration, my profile shows the same time zone configured.
Will work on this project in the next 2 weeks, I'll try to circle back with more info.
Any other things you suggest to try or test?
Comment #10
owenbush commentedNo problem. I'll try and take another look at this for you.
Comment #11
owenbush commentedI think I have managed to recreate this issue. So I will now look into how I can resolve it.
Comment #12
owenbush commentedAttached is a patch to resolve this issue.
Comment #13
owenbush commentedComment #14
dr. gubó commentedI can confirm the patch works, events are created with proper PM times now.
Thanks very much, brilliant!
Comment #15
owenbush commentedThank you for testing it and confirming all is working.
Comment #18
owenbush commentedThis has been merged. Thank you for your help. This will make its way into the next release when I cut it.