Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / lib / Drupal / Component / Datetime / DateTimePlus.php
index 711eb4c9d13ee6b248c8a288318502679c8c8168..11611686728ba198e1c82cd16e4ff6891ea37bd6 100644 (file)
@@ -280,7 +280,7 @@ class DateTimePlus {
    *   parameter and the current timezone are ignored when the $time parameter
    *   either is a UNIX timestamp (e.g. @946684800) or specifies a timezone
    *   (e.g. 2010-01-28T15:00:00+02:00).
-   *   @see http://php.net/manual/en/datetime.construct.php
+   *   @see http://php.net/manual/datetime.construct.php
    * @param array $settings
    *   (optional) Keyed array of settings. Defaults to empty array.
    *   - langcode: (optional) String two letter language code used to control
@@ -704,4 +704,15 @@ class DateTimePlus {
     return $value;
   }
 
+  /**
+   * Sets the default time for an object built from date-only data.
+   *
+   * The default time for a date without time can be anything, so long as it is
+   * consistently applied. If we use noon, dates in most timezones will have the
+   * same value for in both the local timezone and UTC.
+   */
+  public function setDefaultDateTime() {
+    $this->dateTimeObject->setTime(12, 0, 0);
+  }
+
 }