1. 8.3.x core/modules/system/templates/time.html.twig
  2. 8.3.x core/themes/classy/templates/field/time.html.twig
  3. 8.3.x core/themes/stable/templates/field/time.html.twig
  4. 8.0.x core/themes/classy/templates/field/time.html.twig
  5. 8.0.x core/themes/stable/templates/field/time.html.twig
  6. 8.0.x core/modules/system/templates/time.html.twig
  7. 8.1.x core/themes/classy/templates/field/time.html.twig
  8. 8.1.x core/themes/stable/templates/field/time.html.twig
  9. 8.1.x core/modules/system/templates/time.html.twig
  10. 8.2.x core/themes/stable/templates/field/time.html.twig
  11. 8.2.x core/modules/system/templates/time.html.twig
  12. 8.2.x core/themes/classy/templates/field/time.html.twig
  13. 8.4.x core/themes/stable/templates/field/time.html.twig
  14. 8.4.x core/modules/system/templates/time.html.twig
  15. 8.4.x core/themes/classy/templates/field/time.html.twig

Default theme implementation for a date / time element.

Available variables

  • timestamp: (optional) A UNIX timestamp for the datetime attribute. If the datetime cannot be represented as a UNIX timestamp, use a valid datetime attribute value in attributes.datetime.
  • text: (optional) The content to display within the <time> element. Defaults to a human-readable representation of the timestamp value or the datetime attribute value using format_date().
  • attributes: (optional) HTML attributes to apply to the <time> element. A datetime attribute in 'attributes' overrides the 'timestamp'. To create a valid datetime attribute value from a UNIX timestamp, use format_date() with one of the predefined 'html_*' formats.

See also

template_preprocess_time()

http://www.w3.org/TR/html5-author/the-time-element.html#attr-time-datetime

2 theme calls to time.html.twig
DateTimeDefaultFormatter::viewElements in core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
Builds a renderable array for a field value.
DateTimeRangeTrait::buildDateWithIsoAttribute in core/modules/datetime_range/src/DateTimeRangeTrait.php
Creates a render array from a date object with ISO date attribute.

File

core/modules/system/templates/time.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a date / time element.
  5. *
  6. * Available variables
  7. * - timestamp: (optional) A UNIX timestamp for the datetime attribute. If the
  8. * datetime cannot be represented as a UNIX timestamp, use a valid datetime
  9. * attribute value in attributes.datetime.
  10. * - text: (optional) The content to display within the <time> element.
  11. * Defaults to a human-readable representation of the timestamp value or the
  12. * datetime attribute value using format_date().
  13. * - attributes: (optional) HTML attributes to apply to the <time> element.
  14. * A datetime attribute in 'attributes' overrides the 'timestamp'. To
  15. * create a valid datetime attribute value from a UNIX timestamp, use
  16. * format_date() with one of the predefined 'html_*' formats.
  17. *
  18. * @see template_preprocess_time()
  19. * @see http://www.w3.org/TR/html5-author/the-time-element.html#attr-time-datetime
  20. */
  21. #}
  22. <time{{ attributes }}>{{ text }}</time>