|
@@ -0,0 +1,35 @@
|
|
|
|
+From f26202ce5871ee393f86cc4afd79c3b4368c453a Mon Sep 17 00:00:00 2001
|
|
|
|
+From: Bachir Soussi Chiadmi <bachir@figureslibres.io>
|
|
|
|
+Date: Tue, 15 May 2018 13:54:08 +0200
|
|
|
|
+Subject: [PATCH] patched DateRangeFormatter to localized single date
|
|
|
|
+
|
|
|
|
+---
|
|
|
|
+ .../FieldFormatter/DateRangeFormatterRangeFormatter.php | 5 +++--
|
|
|
|
+ 1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
+
|
|
|
|
+diff --git a/sites/all/modules/contrib/fields/date_range_formatter/src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php b/sites/all/modules/contrib/fields/date_range_formatter/src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php
|
|
|
|
+index 26def1be..a7df140d 100644
|
|
|
|
+--- a/sites/all/modules/contrib/fields/date_range_formatter/src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php
|
|
|
|
|
|
|
|
+@@ -63,7 +63,6 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
|
|
|
|
+ if (date('d.m.Y', $start_date) === date('d.m.Y', $end_date)) {
|
|
|
|
+ $format = $this->getSetting('one_day');
|
|
|
|
+ }
|
|
|
|
+-
|
|
|
|
+ $date_str = format_date($start_date, 'custom', preg_replace('/\{([a-zA-Z])\}/', '{\\\$1}', t($format)));
|
|
|
|
+ $matches = array();
|
|
|
|
+ if (preg_match_all('/\{([a-zA-Z])\}/', $date_str, $matches)) {
|
|
|
|
+@@ -75,7 +74,9 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+- $elements[$delta] = ['#markup' => date($this->getSetting('one_day'), $start_date)];
|
|
|
|
++ $format = $this->getSetting('one_day');
|
|
|
|
++ $date_str = format_date($start_date, 'custom', $format);
|
|
|
|
++ $elements[$delta] = ['#markup' => $date_str];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+--
|
|
|
|
+2.17.0
|
|
|
|
+
|