Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
recurring_events-3244975
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
recurring_events-3244975
Commits
08c872bb
Commit
08c872bb
authored
2 years ago
by
Ivan Doroshenko
Committed by
Owen Bush
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3309652
by Matroskeen, owenbush: Timezone is not properly handled in migrate process plugin
parent
ea35528a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/migrate/process/RecurringDate.php
+11
-10
11 additions, 10 deletions
src/Plugin/migrate/process/RecurringDate.php
with
11 additions
and
10 deletions
src/Plugin/migrate/process/RecurringDate.php
+
11
−
10
View file @
08c872bb
...
...
@@ -142,7 +142,7 @@ class RecurringDate extends ProcessPluginBase {
// Take the timezone from the first element, if provided.
$timezone
=
empty
(
$first
[
$timezone_key
])
?
$default_timezone
:
$first
[
$timezone_key
];
$source_timezone
=
new
\DateTimeZone
(
$timezone
);
date_default_timezone_set
(
$timezone
);
$storage_timezone
=
new
\DateTimeZone
(
DateTimeItemInterface
::
STORAGE_TIMEZONE
);
// Check whether the date data is non-associative.
if
(
!
isset
(
$first
[
$value_key
]))
{
...
...
@@ -151,11 +151,9 @@ class RecurringDate extends ProcessPluginBase {
}
// Get values for the first event in the series.
$start_event
=
new
DrupalDateTime
(
$first
[
$value_key
],
DateTimeItemInterface
::
STORAGE_TIMEZONE
);
$start_event
->
setTimezone
(
$source_timezone
);
$start_event
=
new
DrupalDateTime
(
$first
[
$value_key
],
$source_timezone
);
$end_key
=
(
!
empty
(
$first
[
$end_value_key
]))
?
$end_value_key
:
$value_key
;
$end_event
=
new
DrupalDateTime
(
$first
[
$end_key
],
DateTimeItemInterface
::
STORAGE_TIMEZONE
);
$end_event
->
setTimezone
(
$source_timezone
);
$end_event
=
new
DrupalDateTime
(
$first
[
$end_key
],
$source_timezone
);
if
(
!
$duration
=
$end_event
->
getTimestamp
()
-
$start_event
->
getTimestamp
())
{
$duration
=
self
::
DEFAULT_DURATION
;
$end_event
->
add
(
new
\DateInterval
(
'PT'
.
$duration
.
'S'
));
...
...
@@ -172,13 +170,16 @@ class RecurringDate extends ProcessPluginBase {
if
(
empty
(
$rrule
[
'UNTIL'
]))
{
// Get values for the last event in the series.
$end_series
=
new
DrupalDateTime
(
$last
[
$value_key
],
DateTimeItemInterface
::
STORAGE_TIMEZONE
);
$end_series
=
new
DrupalDateTime
(
$last
[
$value_key
],
$source_timezone
);
}
else
{
// Use the UNTIL value as the last event in the series.
$end_series
=
new
DrupalDateTime
(
$rrule
[
'UNTIL'
],
DateTimeItemInterface
::
STORAGE_TIMEZONE
);
$end_series
=
new
DrupalDateTime
(
$rrule
[
'UNTIL'
],
$source_timezone
);
}
$end_series
->
setTimezone
(
$source_timezone
);
// Adjust the timezone before storing values into the database.\
$start_event
->
setTimezone
(
$storage_timezone
);
$end_event
->
setTimezone
(
$storage_timezone
);
$end_series
->
setTimezone
(
$storage_timezone
);
// Set the recurring date field data.
$recurrence_config
=
[];
...
...
@@ -220,8 +221,8 @@ class RecurringDate extends ProcessPluginBase {
$date_start
=
new
DrupalDateTime
(
$date
[
$value_key
],
$source_timezone
);
$date_end
=
new
DrupalDateTime
(
$date
[
$end_value_key
],
$source_timezone
);
$recurrence_config
[]
=
[
'value'
=>
$date_start
->
format
(
RRuleHelper
::
DATETIME_FORMAT
),
'end_value'
=>
$date_end
->
format
(
RRuleHelper
::
DATETIME_FORMAT
),
'value'
=>
$date_start
->
setTimezone
(
$storage_timezone
)
->
format
(
RRuleHelper
::
DATETIME_FORMAT
),
'end_value'
=>
$date_end
->
setTimezone
(
$storage_timezone
)
->
format
(
RRuleHelper
::
DATETIME_FORMAT
),
];
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment