Commit e1c34588 authored by catch's avatar catch

Issue #2999989 by claudiu.cristea, jcnventura, quietone: Deprecate date_iso8601()

parent 0852c7f7
......@@ -332,13 +332,19 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
/**
* Returns an ISO8601 formatted date based on the given date.
*
* @param $date
* @param string $date
* A UNIX timestamp.
*
* @return string
* An ISO8601 formatted date.
*
* @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use
* date('c', $date) instead.
*
* @see https://www.drupal.org/node/2999991
*/
function date_iso8601($date) {
@trigger_error('date_iso8601() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use date("c", $date) instead. See https://www.drupal.org/node/2999991.', E_USER_DEPRECATED);
// The DATE_ISO8601 constant cannot be used here because it does not match
// date('c') and produces invalid RDF markup.
return date('c', $date);
......
......@@ -57,12 +57,12 @@ public function testDatatypeCallback() {
$datatype = 'xsd:dateTime';
$date = 1252750327;
$iso_date = date('c', $date);
$iso_date = $this->container->get('date.formatter')->format($date, 'custom', 'c', 'UTC');
$mapping = [
'datatype' => $datatype,
'properties' => $properties,
'datatype_callback' => ['callable' => 'date_iso8601'],
'datatype_callback' => ['callable' => 'Drupal\rdf\CommonDataConverter::dateIso8601Value'],
];
$expected_attributes = [
'datatype' => $datatype,
......@@ -70,7 +70,7 @@ public function testDatatypeCallback() {
'content' => $iso_date,
];
$this->_testAttributes($expected_attributes, $mapping, $date);
$this->_testAttributes($expected_attributes, $mapping, ['value' => $date]);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment