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
d827cc0a
Commit
d827cc0a
authored
2 years ago
by
Ivan Doroshenko
Committed by
Owen Bush
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3283128
by Matroskeen, owenbush: Use date.formatter service to format date values
parent
0eaad340
No related branches found
Branches containing commit
Tags
2.0.0-beta3
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/views/field/EventSeriesStartDate.php
+18
-1
18 additions, 1 deletion
src/Plugin/views/field/EventSeriesStartDate.php
with
18 additions
and
1 deletion
src/Plugin/views/field/EventSeriesStartDate.php
+
18
−
1
View file @
d827cc0a
...
...
@@ -4,6 +4,7 @@ namespace Drupal\recurring_events\Plugin\views\field;
use
Drupal\views\Plugin\views\field\FieldPluginBase
;
use
Drupal\views\ResultRow
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
* Field handler to show the start date of an event series.
...
...
@@ -14,6 +15,22 @@ use Drupal\views\ResultRow;
*/
class
EventSeriesStartDate
extends
FieldPluginBase
{
/**
* The date formatter service.
*
* @var \Drupal\Core\Datetime\DateFormatterInterface
*/
protected
$dateFormatter
;
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
$instance
=
parent
::
create
(
$container
,
$configuration
,
$plugin_id
,
$plugin_definition
);
$instance
->
dateFormatter
=
$container
->
get
(
'date.formatter'
);
return
$instance
;
}
/**
* {@inheritdoc}
*/
...
...
@@ -33,7 +50,7 @@ class EventSeriesStartDate extends FieldPluginBase {
if
(
!
empty
(
$event_start
))
{
$format
=
\Drupal
::
config
(
'recurring_events.eventseries.config'
)
->
get
(
'date_format'
);
$start_date
=
$event_start
->
s
etTime
zone
(
$timezone
)
->
format
(
$format
);
$start_date
=
$this
->
dateFormatter
->
format
(
$event_start
->
g
etTime
stamp
(),
'custom'
,
$format
,
$timezone
->
getName
()
);
}
return
$start_date
;
}
...
...
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