You are here

public static function SmartDateTrait::settingsFormatNoTz in Smart Date 3.4.x

Same name and namespace in other branches
  1. 3.1.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::settingsFormatNoTz()
  2. 3.2.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::settingsFormatNoTz()
  3. 3.3.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::settingsFormatNoTz()

Removes timezone tokens from time settings.

Parameters

array $settings: The formatter settings.

Return value

array The settings with timezone output stripped.

File

src/SmartDateTrait.php, line 428

Class

SmartDateTrait
Provides friendly methods for smart date range.

Namespace

Drupal\smart_date

Code

public static function settingsFormatNoTz(array $settings = []) {
  if (isset($settings['time_format'])) {
    $settings['time_format'] = preg_replace('/\\s*(?<![\\\\])[eOPTZ]/i', '', $settings['time_format']);
  }
  if (isset($settings['time_hour_format'])) {
    $settings['time_hour_format'] = preg_replace('/\\s*(?<![\\\\])[eOPTZ]/i', '', $settings['time_hour_format']);
  }
  return $settings;
}