Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / datetime / datetime.module
index bb10d13a6ceb0068be1ca80542ef22cd05321337..245d0c4e63bf201028d51456d97adb4cc28e799d 100644 (file)
@@ -9,16 +9,34 @@ use Drupal\Core\Routing\RouteMatchInterface;
 
 /**
  * Defines the timezone that dates should be stored in.
+ *
+ * @deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use
+ * \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::STORAGE_TIMEZONE
+ * instead.
+ *
+ * @see https://www.drupal.org/node/2912980
  */
 const DATETIME_STORAGE_TIMEZONE = 'UTC';
 
 /**
  * Defines the format that date and time should be stored in.
+ *
+ * @deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use
+ * \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATETIME_STORAGE_FORMAT
+ * instead.
+ *
+ * @see https://www.drupal.org/node/2912980
  */
 const DATETIME_DATETIME_STORAGE_FORMAT = 'Y-m-d\TH:i:s';
 
 /**
  * Defines the format that dates should be stored in.
+ *
+ * @deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use
+ * \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATE_STORAGE_FORMAT
+ * instead.
+ *
+ * @see https://www.drupal.org/node/2912980
  */
 const DATETIME_DATE_STORAGE_FORMAT = 'Y-m-d';
 
@@ -50,7 +68,20 @@ function datetime_help($route_name, RouteMatchInterface $route_match) {
  * same value for in both the local timezone and UTC.
  *
  * @param $date
+ *
+ * @deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use
+ *   \Drupal\Component\Datetime\DateTimePlus::setDefaultDateTime() or
+ *   \Drupal\Core\Datetime\DrupalDateTime::setDefaultDateTime() instead.
+ *
+ * @see https://www.drupal.org/node/2880931
  */
 function datetime_date_default_time($date) {
+  @trigger_error('datetime_date_default_time() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use \Drupal\Component\Datetime\DateTimePlus::setDefaultDateTime() or \Drupal\Core\Datetime\DrupalDateTime::setDefaultDateTime() instead. See https://www.drupal.org/node/2880931.', E_USER_DEPRECATED);
+
+  // For maximum BC before this method is removed, we do not use the
+  // recommendation from the deprecation method. Instead, we call the setTime()
+  // method directly. This allows the method to continue to work with
+  // \DateTime, DateTimePlus, and DrupalDateTime objects (and classes that
+  // may derive from them).
   $date->setTime(12, 0, 0);
 }