Verified Commit dfe15ca8 authored by Dave Long's avatar Dave Long
Browse files

Issue #3411922 by pradhumanjain2311, Tanuj., divya.sejekan, Chi, smustgrave:...

Issue #3411922 by pradhumanjain2311, Tanuj., divya.sejekan, Chi, smustgrave: Increase max allowed granularity in Time ago formatter
parent eb8cd5d6
Loading
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
      '#description' => $this->t('How many time interval units should be shown in the formatted output.'),
      '#default_value' => $this->getSetting('granularity') ?: 2,
      '#min' => 1,
      '#max' => 6,
      '#max' => 7,
    ];

    return $form;
@@ -140,8 +140,8 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
  public function settingsSummary() {
    $summary = parent::settingsSummary();

    $future_date = new DrupalDateTime('1 year 1 month 1 week 1 day 1 hour 1 minute');
    $past_date = new DrupalDateTime('-1 year -1 month -1 week -1 day -1 hour -1 minute');
    $future_date = new DrupalDateTime('1 year 1 month 1 week 1 day 1 hour 1 minute 1 second');
    $past_date = new DrupalDateTime('-1 year -1 month -1 week -1 day -1 hour -1 minute -1 second');
    $granularity = $this->getSetting('granularity');
    $options = [
      'granularity' => $granularity,
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ public function testTimestampFormatter() {
  public function testTimestampAgoFormatter() {
    $data = [];

    foreach ([1, 2, 3, 4, 5, 6] as $granularity) {
    foreach ([1, 2, 3, 4, 5, 6, 7] as $granularity) {
      $data[] = [
        'future_format' => '@interval hence',
        'past_format' => '@interval ago',