datetimeRangeYears example

$format = 'j';
          $title = t('Day');
          break;

        case 'month':
          $options = $date_helper->monthNamesAbbr($element['#required']);
          $format = 'n';
          $title = t('Month');
          break;

        case 'year':
          $range = static::datetimeRangeYears($element['#date_year_range']$date);
          $options = $date_helper->years($range[0]$range[1]$element['#required']);
          $format = 'Y';
          $title = t('Year');
          break;

        case 'hour':
          $format = in_array('ampm', $element['#date_part_order']) ? 'g' : 'G';
          $options = $date_helper->hours($format$element['#required']);
          $title = t('Hour');
          break;

        
// Creating format examples on every individual date item is messy, and       // placeholders are invalid for HTML5 date and datetime, so an example       // format is appended to the title to appear in tooltips.       $extra_attributes = [
        'title' => t('Date (e.g. @format)', ['@format' => static::formatExample($date_format)]),
        'type' => $element['#date_date_element'],
      ];

      // Adds the HTML5 date attributes.       if ($date instanceof DrupalDateTime && !$date->hasErrors()) {
        $html5_min = clone($date);
        $range = static::datetimeRangeYears($element['#date_year_range']$date);
        $html5_min->setDate($range[0], 1, 1)->setTime(0, 0, 0);
        $html5_max = clone($date);
        $html5_max->setDate($range[1], 12, 31)->setTime(23, 59, 59);

        $extra_attributes += [
          'min' => $html5_min->format($date_format$format_settings),
          'max' => $html5_max->format($date_format$format_settings),
        ];
      }

      $element['date'] = [
        
Home | Imprint | This part of the site doesn't use cookies.