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.

Comments

dr. gubó created an issue. See original summary.

dr. gubó’s picture

Issue summary: View changes
owenbush’s picture

Thanks 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.

dr. gubó’s picture

I 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!

owenbush’s picture

So 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:

  • Enable Recurring Events
  • Enable Language
  • Enable Content Translation
  • Enabled translation of Event Series and Event Instance entity types
  • Add Hungarian (hu) language
  • Add an event series by going to /hu/events/add/default
  • Create a daily event with a start time of 5:00 PM and a duration of 3 hours

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.

owenbush’s picture

I 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.

dr. gubó’s picture

@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.

owenbush’s picture

I'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/settings

2. 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]/edit

dr. gubó’s picture

Sorry 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?

owenbush’s picture

No problem. I'll try and take another look at this for you.

owenbush’s picture

I think I have managed to recreate this issue. So I will now look into how I can resolve it.

owenbush’s picture

Status: Active » Needs review
StatusFileSize
new648 bytes

Attached is a patch to resolve this issue.

owenbush’s picture

Issue tags: +rc eligible
dr. gubó’s picture

I can confirm the patch works, events are created with proper PM times now.
Thanks very much, brilliant!

owenbush’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for testing it and confirming all is working.

  • owenbush committed 7e1ff40 on 8.x-1.x
    Issue #3190077 by owenbush, dr. gubó: Recurring event instances with PM...

  • owenbush committed 8238cc4 on 2.0.x
    Issue #3190077 by owenbush, dr. gubó: Recurring event instances with PM...
owenbush’s picture

Status: Reviewed & tested by the community » Fixed

This has been merged. Thank you for your help. This will make its way into the next release when I cut it.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.