diff --git a/core/includes/common.inc b/core/includes/common.inc index 03af03b..3119fd1 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -331,11 +331,16 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL * * @return string * An ISO8601 formatted date. + * + * @see \Drupal\Core\Datetime\DateFormatter::format() + * + * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. + * Use \Drupal::service('date.formatter')->format(). */ function date_iso8601($date) { // The DATE_ISO8601 constant cannot be used here because it does not match // date('c') and produces invalid RDF markup. - return date('c', $date); + return \Drupal::service('date.formatter')->format($date, 'custom', 'c', 'UTC'); } /** diff --git a/core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php b/core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php index 42a4dc4..dcc4eb6 100644 --- a/core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php +++ b/core/modules/rdf/tests/src/Kernel/RdfaAttributesTest.php @@ -57,7 +57,7 @@ function testDatatypeCallback() { $datatype = 'xsd:dateTime'; $date = 1252750327; - $iso_date = date('c', $date); + $iso_date = \Drupal::service('date.formatter')->format($date, 'custom', 'c', 'UTC'); $mapping = array( 'datatype' => $datatype,