diff --git a/core/modules/datetime/datetime.install b/core/modules/datetime/datetime.install
new file mode 100644
index 0000000..45c593c
--- /dev/null
+++ b/core/modules/datetime/datetime.install
@@ -0,0 +1,84 @@
+useCaches(FALSE);
+ $change_list = [];
+
+ foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
+ if ($entity_manager->getStorage($entity_type_id) instanceof \Drupal\Core\Entity\Schema\DynamicallyFieldableEntityStorageSchemaInterface) {
+ $field_changes = [];
+
+ $storage_definitions = $entity_manager->getFieldStorageDefinitions($entity_type_id);
+ $original_storage_definitions = $entity_manager->getLastInstalledFieldStorageDefinitions($entity_type_id);
+
+ // Detect updated field storage definitions.
+ foreach (array_intersect_key($storage_definitions, $original_storage_definitions) as $field_name => $storage_definition) {
+ if ($storage_definition->getType() === 'datetime') {
+ if ($entity_manager->getStorage($entity_type_id)->requiresFieldStorageSchemaChanges($storage_definition, $original_storage_definitions[$field_name])) {
+ $field_changes[$field_name] = TRUE;
+ }
+ }
+ }
+
+ if ($field_changes) {
+ $change_list[$entity_type_id] = [
+ 'field_storage_definitions' => $field_changes,
+ 'base_table' => $entity_type->getBaseTable(),
+ 'revision_table' => $entity_type->getRevisionTable(),
+ ];
+ }
+ }
+ }
+
+ $field_spec = [
+ 'description' => 'The date value.',
+ 'type' => 'varchar',
+ 'length' => 25,
+ ];
+
+ $keys_new = [
+ 'value' => ['value'],
+ ];
+
+ $schema = \Drupal::database()->schema();
+
+ foreach ($change_list as $entity_type_id => $changes) {
+ foreach (array_keys($changes['field_storage_definitions']) as $field_name) {
+ $value_field_name = $field_name . '_value';
+
+ $base_table = $changes['base_table'] . '__' . $field_name;
+ $schema->dropIndex($base_table, 'value');
+ $schema->changeField($base_table, $value_field_name, $value_field_name, $field_spec, $keys_new);
+
+ \Drupal::database()
+ ->update($base_table)
+ ->expression($value_field_name, "CONCAT({$value_field_name}, :offset)", [
+ ':offset' => '+00:00',
+ ])
+ ->execute();
+
+ if ($changes['revision_table']) {
+ $revision_table = $changes['revision_table'] . '__' . $field_name;
+ $schema->dropIndex($revision_table, 'value');
+ $schema->changeField($revision_table, $value_field_name, $value_field_name, $field_spec, $keys_new);
+
+ \Drupal::database()
+ ->update($revision_table)
+ ->expression($value_field_name, "CONCAT({$value_field_name}, :offset)", [
+ ':offset' => '+00:00',
+ ])
+ ->execute();
+ }
+ }
+ }
+}
diff --git a/core/modules/datetime/datetime.module b/core/modules/datetime/datetime.module
index 245d0c4..a925706 100644
--- a/core/modules/datetime/datetime.module
+++ b/core/modules/datetime/datetime.module
@@ -27,7 +27,7 @@
*
* @see https://www.drupal.org/node/2912980
*/
-const DATETIME_DATETIME_STORAGE_FORMAT = 'Y-m-d\TH:i:s';
+const DATETIME_DATETIME_STORAGE_FORMAT = 'Y-m-d\TH:i:s+00:00';
/**
* Defines the format that dates should be stored in.
diff --git a/core/modules/datetime/src/DateTimeComputed.php b/core/modules/datetime/src/DateTimeComputed.php
index 16f664b..5ea3652 100644
--- a/core/modules/datetime/src/DateTimeComputed.php
+++ b/core/modules/datetime/src/DateTimeComputed.php
@@ -2,11 +2,11 @@
namespace Drupal\datetime;
-use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\TypedData\DataDefinitionInterface;
use Drupal\Core\TypedData\TypedDataInterface;
use Drupal\Core\TypedData\TypedData;
+use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface;
/**
@@ -48,6 +48,7 @@ public function getValue() {
$datetime_type = $item->getFieldDefinition()->getSetting('datetime_type');
$storage_format = $datetime_type === DateTimeItem::DATETIME_TYPE_DATE ? DateTimeItemInterface::DATE_STORAGE_FORMAT : DateTimeItemInterface::DATETIME_STORAGE_FORMAT;
+
try {
$date = DrupalDateTime::createFromFormat($storage_format, $value, DateTimeItemInterface::STORAGE_TIMEZONE);
if ($date instanceof DrupalDateTime && !$date->hasErrors()) {
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php
index a6680f6..1d41688 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php
@@ -227,7 +227,7 @@ protected function buildDate(DrupalDateTime $date) {
*/
protected function buildDateWithIsoAttribute(DrupalDateTime $date) {
// Create the ISO date in Universal Time.
- $iso_date = $date->format("Y-m-d\TH:i:s") . 'Z';
+ $iso_date = $date->format("Y-m-d\TH:i:sP", ['timezone' => 'UTC']);
$this->setTimeZone($date);
diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
index 3264069..6528192 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
@@ -69,7 +69,7 @@ public static function schema(FieldStorageDefinitionInterface $field_definition)
'value' => [
'description' => 'The date value.',
'type' => 'varchar',
- 'length' => 20,
+ 'length' => 25,
],
],
'indexes' => [
diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItemInterface.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItemInterface.php
index a9231c6..ae0343e 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItemInterface.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItemInterface.php
@@ -15,7 +15,7 @@
/**
* Defines the format that date and time should be stored in.
*/
- const DATETIME_STORAGE_FORMAT = 'Y-m-d\TH:i:s';
+ const DATETIME_STORAGE_FORMAT = 'Y-m-d\TH:i:s\+00:00';
/**
* Defines the format that dates should be stored in.
diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
index 5acd6fc..c9ceea3 100644
--- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
+++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
@@ -116,7 +116,7 @@ public function testDateField() {
// Verify that a date is displayed. Since this is a date-only
// field, it is expected to display the time as 00:00:00.
$expected = format_date($date->getTimestamp(), $new_value, '', DateTimeItemInterface::STORAGE_TIMEZONE);
- $expected_iso = format_date($date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', DateTimeItemInterface::STORAGE_TIMEZONE);
+ $expected_iso = format_date($date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', DateTimeItemInterface::STORAGE_TIMEZONE);
$output = $this->renderTestEntity($id);
$expected_markup = '';
$this->assertContains($expected_markup, $output, new FormattableMarkup('Formatted date field using %value format displayed as %expected with %expected_iso attribute in %timezone.', [
@@ -282,7 +282,7 @@ public function testDatetimeField() {
case 'format_type':
// Verify that a date is displayed.
$expected = format_date($date->getTimestamp(), $new_value);
- $expected_iso = format_date($date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
+ $expected_iso = format_date($date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', 'UTC');
$output = $this->renderTestEntity($id);
$expected_markup = '';
$this->assertContains($expected_markup, $output, SafeMarkup::format('Formatted date field using %value format displayed as %expected with %expected_iso attribute.', ['%value' => $new_value, '%expected' => $expected, '%expected_iso' => $expected_iso]));
diff --git a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php
index ffce48c..1b02e08 100644
--- a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php
+++ b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php
@@ -5,6 +5,7 @@
use Drupal\Core\Url;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
+use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
@@ -25,7 +26,7 @@ class EntityTestDatetimeTest extends EntityTestResourceTestBase {
*
* @var string
*/
- protected static $dateString = '2017-03-01T20:02:00';
+ protected static $dateString = '2017-03-01T20:02:00+00:00';
/**
* Datetime test field name.
@@ -136,17 +137,17 @@ protected function assertNormalizationEdgeCases($method, Url $url, array $reques
$request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format);
$response = $this->request($method, $url, $request_options);
- $message = "Unprocessable Entity: validation failed.\n{$fieldName}.0: The datetime value '{$value}' is invalid for the format 'Y-m-d\\TH:i:s'\n";
+ $message = "Unprocessable Entity: validation failed.\n{$fieldName}.0: The datetime value '{$value}' is invalid for the format '" . DateTimeItemInterface::DATETIME_STORAGE_FORMAT . "'\n";
$this->assertResourceErrorResponse(422, $message, $response);
// DX: 422 when date format is incorrect.
$normalization = $this->getNormalizedPostEntity();
- $value = '2017-13-55T20:02:00';
+ $value = '2017-13-55T20:02:00+00:00';
$normalization[static::$fieldName][0]['value'] = $value;
$request_options[RequestOptions::BODY] = $this->serializer->encode($normalization, static::$format);
$response = $this->request($method, $url, $request_options);
- $message = "Unprocessable Entity: validation failed.\n{$fieldName}.0: The datetime value '{$value}' did not parse properly for the format 'Y-m-d\\TH:i:s'\n{$fieldName}.0.value: This value should be of the correct primitive type.\n";
+ $message = "Unprocessable Entity: validation failed.\n{$fieldName}.0: The datetime value '{$value}' did not parse properly for the format '" . DateTimeItemInterface::DATETIME_STORAGE_FORMAT . "'\n{$fieldName}.0.value: This value should be of the correct primitive type.\n";
$this->assertResourceErrorResponse(422, $message, $response);
}
}
diff --git a/core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php b/core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php
index 75f892a..dc145b1 100644
--- a/core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php
+++ b/core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php
@@ -69,7 +69,7 @@ public function testDateTime() {
// Verify entity creation.
$entity = EntityTest::create();
- $value = '2014-01-01T20:00:00';
+ $value = '2014-01-01T20:00:00+00:00';
$entity->field_datetime = $value;
$entity->name->value = $this->randomMachineName();
$this->entityValidateAndSave($entity);
@@ -84,7 +84,7 @@ public function testDateTime() {
$this->assertEquals(DateTimeItemInterface::STORAGE_TIMEZONE, $entity->field_datetime->date->getTimeZone()->getName());
// Verify changing the date value.
- $new_value = '2016-11-04T00:21:00';
+ $new_value = '2016-11-04T00:21:00+00:00';
$entity->field_datetime->value = $new_value;
$this->assertEqual($entity->field_datetime->value, $new_value);
$this->assertEquals(DateTimeItemInterface::STORAGE_TIMEZONE, $entity->field_datetime->date->getTimeZone()->getName());
@@ -164,7 +164,7 @@ public function testSetValue() {
// Test DateTimeItem::setValue() using string.
$entity = EntityTest::create();
- $value = '2014-01-01T20:00:00';
+ $value = '2014-01-01T20:00:00+00:00';
$entity->get('field_datetime')->set(0, $value);
$this->entityValidateAndSave($entity);
// Load the entity and ensure the field was saved correctly.
@@ -175,7 +175,7 @@ public function testSetValue() {
// Test DateTimeItem::setValue() using property array.
$entity = EntityTest::create();
- $value = '2014-01-01T20:00:00';
+ $value = '2014-01-01T20:00:00+00:00';
$entity->set('field_datetime', $value);
$this->entityValidateAndSave($entity);
// Load the entity and ensure the field was saved correctly.
@@ -220,7 +220,7 @@ public function testSetValueProperty() {
$this->fieldStorage->setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATETIME);
$this->fieldStorage->save();
$entity = EntityTest::create();
- $value = '2014-01-01T20:00:00';
+ $value = '2014-01-01T20:00:00+00:00';
$entity->set('field_datetime', $value);
$this->entityValidateAndSave($entity);
@@ -269,10 +269,10 @@ public function datetimeValidationProvider() {
return [
// Valid ISO 8601 dates, but unsupported by DateTimeItem.
['2014-01-01T20:00:00Z'],
- ['2014-01-01T20:00:00+04:00'],
['2014-01-01T20:00:00+0400'],
['2014-01-01T20:00:00+04'],
['2014-01-01T20:00:00.123'],
+ ['2014-01-01T20:00:00'],
['2014-01-01T200000'],
['2014-01-01T2000'],
['2014-01-01T20'],
diff --git a/core/modules/datetime/tests/src/Kernel/Views/FilterDateTimeTest.php b/core/modules/datetime/tests/src/Kernel/Views/FilterDateTimeTest.php
index 7cb0fa0..17cf74b 100644
--- a/core/modules/datetime/tests/src/Kernel/Views/FilterDateTimeTest.php
+++ b/core/modules/datetime/tests/src/Kernel/Views/FilterDateTimeTest.php
@@ -46,9 +46,9 @@ protected function setUp($import_test_views = TRUE) {
// Add some basic test nodes.
$dates = [
- '2000-10-10T00:01:30',
- '2001-10-10T12:12:12',
- '2002-10-10T14:14:14',
+ '2000-10-10T00:01:30+00:00',
+ '2001-10-10T12:12:12+00:00',
+ '2002-10-10T14:14:14+00:00',
// The date storage timezone is used (this mimics the steps taken in the
// widget: \Drupal\datetime\Plugin\Field\FieldWidget::messageFormValues().
\Drupal::service('date.formatter')->format(static::$date, 'custom', DateTimeItemInterface::DATETIME_STORAGE_FORMAT, DateTimeItemInterface::STORAGE_TIMEZONE),
@@ -187,7 +187,7 @@ protected function _testExact() {
$view->filter[$field]->value['max'] = '';
// Use the date from node 3. Use the site timezone (mimics a value entered
// through the UI).
- $view->filter[$field]->value['value'] = \Drupal::service('date.formatter')->format(static::$date, 'custom', DateTimeItemInterface::DATETIME_STORAGE_FORMAT, static::$timezone);
+ $view->filter[$field]->value['value'] = \Drupal::service('date.formatter')->format(static::$date, 'custom', 'Y-m-d\TH:i:s', static::$timezone);
$view->setDisplay('default');
$this->executeView($view);
$expected_result = [
diff --git a/core/modules/datetime_range/datetime_range.install b/core/modules/datetime_range/datetime_range.install
new file mode 100644
index 0000000..1285cf9
--- /dev/null
+++ b/core/modules/datetime_range/datetime_range.install
@@ -0,0 +1,108 @@
+useCaches(FALSE);
+ $change_list = [];
+
+ foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
+ if ($entity_manager->getStorage($entity_type_id) instanceof \Drupal\Core\Entity\Schema\DynamicallyFieldableEntityStorageSchemaInterface) {
+ $field_changes = [];
+
+ $storage_definitions = $entity_manager->getFieldStorageDefinitions($entity_type_id);
+ $original_storage_definitions = $entity_manager->getLastInstalledFieldStorageDefinitions($entity_type_id);
+
+ // Detect updated field storage definitions.
+ foreach (array_intersect_key($storage_definitions, $original_storage_definitions) as $field_name => $storage_definition) {
+ if ($storage_definition->getType() === 'daterange') {
+ if ($entity_manager->getStorage($entity_type_id)->requiresFieldStorageSchemaChanges($storage_definition, $original_storage_definitions[$field_name])) {
+ $field_changes[$field_name] = TRUE;
+ }
+ }
+ }
+
+ if ($field_changes) {
+ $change_list[$entity_type_id] = [
+ 'field_storage_definitions' => $field_changes,
+ 'base_table' => $entity_type->getBaseTable(),
+ 'revision_table' => $entity_type->getRevisionTable(),
+ ];
+ }
+ }
+ }
+
+ $field_spec = [
+ 'description' => 'The start date value.',
+ 'type' => 'varchar',
+ 'length' => 25,
+ ];
+
+ $end_field_spec = [
+ 'description' => 'The end date value.',
+ 'type' => 'varchar',
+ 'length' => 25,
+ ];
+
+ $keys_new = [
+ 'value' => ['value'],
+ ];
+
+ $end_keys_new = [
+ 'end_value' => ['end_value'],
+ ];
+
+ $schema = \Drupal::database()->schema();
+
+ foreach ($change_list as $entity_type_id => $changes) {
+ foreach (array_keys($changes['field_storage_definitions']) as $field_name) {
+ $value_field_name = $field_name . '_value';
+ $end_value_field_name = $field_name . 'end_value';
+
+ $base_table = $changes['base_table'] . '__' . $field_name;
+ $schema->dropIndex($base_table, 'value');
+ $schema->changeField($base_table, $value_field_name, $value_field_name, $field_spec, $keys_new);
+ $schema->dropIndex($base_table, 'end_value');
+ $schema->changeField($base_table, $end_value_field_name, $end_value_field_name, $end_field_spec, $end_keys_new);
+
+ \Drupal::database()
+ ->update($base_table)
+ ->expression($value_field_name, "CONCAT({$value_field_name}, :offset)", [
+ ':offset' => '+00:00',
+ ])
+ ->expression($end_value_field_name, "CONCAT({$end_value_field_name}, :offset)", [
+ ':offset' => '+00:00',
+ ])
+ ->execute();
+
+ if ($changes['revision_table']) {
+ $revision_table = $changes['revision_table'] . '__' . $field_name;
+ $schema->dropIndex($revision_table, 'value');
+ $schema->changeField($revision_table, $value_field_name, $value_field_name, $field_spec, $keys_new);
+ $schema->dropIndex($revision_table, 'end_value');
+ $schema->changeField($revision_table, $end_value_field_name, $end_value_field_name, $end_field_spec, $end_keys_new);
+
+ $results = \Drupal::database()->query('SELECT * FROM ' . $revision_table)->fetchAll();
+ foreach ($results as &$result) {
+ \Drupal::database()
+ ->update($revision_table)
+ ->expression($value_field_name, "CONCAT({$value_field_name}, :offset)", [
+ ':offset' => '+00:00',
+ ])
+ ->expression($end_value_field_name, "CONCAT({$end_value_field_name}, :offset)", [
+ ':offset' => '+00:00',
+ ])
+ ->execute();
+ }
+ }
+ }
+ }
+}
diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
index bd83b98..b143e8c 100644
--- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
+++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
@@ -130,10 +130,10 @@ public function testDateRangeField() {
->save();
$start_expected = $this->dateFormatter->format($start_date->getTimestamp(), 'long', '', DateTimeItemInterface::STORAGE_TIMEZONE);
- $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', DateTimeItemInterface::STORAGE_TIMEZONE);
+ $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', DateTimeItemInterface::STORAGE_TIMEZONE);
$start_expected_markup = '';
$end_expected = $this->dateFormatter->format($end_date->getTimestamp(), 'long', '', DateTimeItemInterface::STORAGE_TIMEZONE);
- $end_expected_iso = $this->dateFormatter->format($end_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', DateTimeItemInterface::STORAGE_TIMEZONE);
+ $end_expected_iso = $this->dateFormatter->format($end_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', DateTimeItemInterface::STORAGE_TIMEZONE);
$end_expected_markup = '';
$output = $this->renderTestEntity($id);
$this->assertContains($start_expected_markup, $output, new FormattableMarkup('Formatted date field using %value format displayed as %expected with %expected_iso attribute in %timezone.', [
@@ -228,7 +228,7 @@ public function testDateRangeField() {
->save();
$start_expected = $this->dateFormatter->format($start_date->getTimestamp(), 'long', '', DateTimeItemInterface::STORAGE_TIMEZONE);
- $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', DateTimeItemInterface::STORAGE_TIMEZONE);
+ $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', DateTimeItemInterface::STORAGE_TIMEZONE);
$start_expected_markup = '';
$output = $this->renderTestEntity($id);
$this->assertContains($start_expected_markup, $output, new FormattableMarkup('Formatted date field using %value format displayed as %expected with %expected_iso attribute in %timezone.', [
@@ -332,10 +332,10 @@ public function testDatetimeRangeField() {
->save();
$start_expected = $this->dateFormatter->format($start_date->getTimestamp(), 'long');
- $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
+ $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', 'UTC');
$start_expected_markup = '';
$end_expected = $this->dateFormatter->format($end_date->getTimestamp(), 'long');
- $end_expected_iso = $this->dateFormatter->format($end_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
+ $end_expected_iso = $this->dateFormatter->format($end_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', 'UTC');
$end_expected_markup = '';
$output = $this->renderTestEntity($id);
$this->assertContains($start_expected_markup, $output, new FormattableMarkup('Formatted date field using %value format displayed as %expected with %expected_iso attribute.', ['%value' => 'long', '%expected' => $start_expected, '%expected_iso' => $start_expected_iso]));
@@ -413,7 +413,7 @@ public function testDatetimeRangeField() {
->save();
$start_expected = $this->dateFormatter->format($start_date->getTimestamp(), 'long');
- $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
+ $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', 'UTC');
$start_expected_markup = '';
$output = $this->renderTestEntity($id);
$this->assertContains($start_expected_markup, $output, new FormattableMarkup('Formatted date field using %value format displayed as %expected with %expected_iso attribute.', ['%value' => 'long', '%expected' => $start_expected, '%expected_iso' => $start_expected_iso]));
@@ -500,10 +500,10 @@ public function testAlldayRangeField() {
->save();
$start_expected = $this->dateFormatter->format($start_date->getTimestamp(), 'long');
- $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
+ $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', 'UTC');
$start_expected_markup = '';
$end_expected = $this->dateFormatter->format($end_date->getTimestamp(), 'long');
- $end_expected_iso = $this->dateFormatter->format($end_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
+ $end_expected_iso = $this->dateFormatter->format($end_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', 'UTC');
$end_expected_markup = '';
$output = $this->renderTestEntity($id);
$this->assertContains($start_expected_markup, $output, new FormattableMarkup('Formatted date field using %value format displayed as %expected with %expected_iso attribute.', ['%value' => 'long', '%expected' => $start_expected, '%expected_iso' => $start_expected_iso]));
@@ -580,10 +580,10 @@ public function testAlldayRangeField() {
->save();
$start_expected = $this->dateFormatter->format($start_date->getTimestamp(), 'long');
- $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
+ $start_expected_iso = $this->dateFormatter->format($start_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', 'UTC');
$start_expected_markup = '';
$end_expected = $this->dateFormatter->format($end_date->getTimestamp(), 'long');
- $end_expected_iso = $this->dateFormatter->format($end_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s\Z', 'UTC');
+ $end_expected_iso = $this->dateFormatter->format($end_date->getTimestamp(), 'custom', 'Y-m-d\TH:i:s+00:00', 'UTC');
$end_expected_markup = '';
$output = $this->renderTestEntity($id);
$this->assertContains($start_expected_markup, $output, new FormattableMarkup('Formatted date field using %value format displayed as %expected with %expected_iso attribute.', ['%value' => 'long', '%expected' => $start_expected, '%expected_iso' => $start_expected_iso]));
diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php
index e7ae850..cbce0a7 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldBlockTest.php
@@ -41,7 +41,7 @@ protected function setUp() {
'administer blocks',
'access administration pages',
]);
- $user->field_date = '1978-11-19T05:00:00';
+ $user->field_date = '1978-11-19T05:00:00+00:00';
$user->save();
$this->drupalLogin($user);
}
diff --git a/core/modules/rdf/tests/src/Kernel/Field/DateTimeFieldRdfaTest.php b/core/modules/rdf/tests/src/Kernel/Field/DateTimeFieldRdfaTest.php
index fc78691..eb5f934 100644
--- a/core/modules/rdf/tests/src/Kernel/Field/DateTimeFieldRdfaTest.php
+++ b/core/modules/rdf/tests/src/Kernel/Field/DateTimeFieldRdfaTest.php
@@ -21,7 +21,7 @@ class DateTimeFieldRdfaTest extends FieldRdfaTestBase {
*
* @var string
*/
- protected $testValue = '2014-01-28T06:01:01';
+ protected $testValue = '2014-01-28T06:01:01+00:00';
/**
* {@inheritdoc}
@@ -48,7 +48,7 @@ protected function setUp() {
* Tests the default formatter.
*/
public function testDefaultFormatter() {
- $this->assertFormatterRdfa(['type' => 'datetime_default'], 'http://schema.org/dateCreated', ['value' => $this->testValue . 'Z', 'type' => 'literal', 'datatype' => 'http://www.w3.org/2001/XMLSchema#dateTime']);
+ $this->assertFormatterRdfa(['type' => 'datetime_default'], 'http://schema.org/dateCreated', ['value' => $this->testValue, 'type' => 'literal', 'datatype' => 'http://www.w3.org/2001/XMLSchema#dateTime']);
}
}