Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1] Fix issue with wrong date on event creating #7775

Closed

Conversation

dragomano
Copy link
Contributor

This issue is actual only for some languages (French, Russian, etc)

Fixes #7630
Closes #7630

@@ -362,7 +362,7 @@ function addPollOption()
<div class="files" id="attachment_previews">
<div id="au-template">
<div class="attachment_preview_wrapper">
<div class="attach-ui">
<div class="attach-ui roundframe">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is an ui change needed for this issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary. Maybe it's because I haven't updated the fork in a while.

Copy link
Member

@Sesquipedalian Sesquipedalian Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that part of the recent attachment UI changes were accidentally merged into this PR.

Themes/default/Post.template.php Outdated Show resolved Hide resolved
@sbulen sbulen added the Calendar label Jul 9, 2023
@sbulen sbulen added this to the 2.1.5 milestone Jul 9, 2023
@dragomano dragomano changed the title Fix issue with wrong date on event creating [2.1] Fix issue with wrong date on event creating Feb 7, 2024
@Sesquipedalian
Copy link
Member

This won't work correctly. $context['event']['start_date_orig'] gives the start date according to the event's own time zone, whereas $context['event']['start_date'] gives the start date according to the viewing user's time zone. So if the event's internal data says that it starts at 2024-05-21 23:00:00 Europe/Dublin and user's time zone is Europe/Moscow, then $context['event']['start_date_orig'] will say 2024-05-21, but $context['event']['start_date'] will say 2024-05-22, because 2024-05-21 23:00:00 Europe/Dublin is 2024-05-22 01:00:00 Europe/Moscow.

@dragomano
Copy link
Contributor Author

The problem is that start_date_org contains the date not in the format that you mention in the example. In the case of English, there will be no problems, but with Cyrillic dates, an error Invalid date will occur when creating an event. If you are not sure about start_date, I can use date('Y-m-d', $context['event']['start_timestamp']) in a hidden field,. Likewise for end_date_orig and end_timestamp.

  1. Open "Post event" page:
    sshot-28
  2. Select any date via date widget - as you see, the format changes
    sshot-29

Results for English
sshot-27
Results for Russian
sshot-26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid date when posting calendar event with default french format
5 participants