Add "All day" to render array

Created on 6 May 2025, about 2 months ago

Problem/Motivation

The render array of the field does not have any usable information if the date is an all day event or not. Since this issue Time suffix required for some languages isn't solved, there's no way to add the suffix "Uhr" in german to the datetime. If there would be a key in the array like "all_day" => true/false we could help us with reading these values within twig or preprocesses.

Here's an example array of an all day event "07. - 10.05.2025, All day":

array:6 [
  "start" => array:3 [
    "#theme" => "time"
    "#attributes" => array:1 [
      "datetime" => "2025-05-07"
    ]
    "#text" => array:1 [
      "date" => array:2 [
        "value" => array:1 [
          "#markup" => "07."
        ]
        "#format" => array:1 [
          "#markup" => "d."
        ]
      ]
    ]
  ]
  "separator" => array:1 [
    "#markup" => " - "
  ]
  "end" => array:3 [
    "#theme" => "time"
    "#attributes" => array:1 [
      "datetime" => "2025-05-10"
    ]
    "#text" => array:3 [
      "date" => array:2 [
        "value" => array:1 [
          "#markup" => "10.05.2025"
        ]
        "#format" => array:1 [
          "#markup" => "d.m.Y"
        ]
      ]
      "join" => array:1 [
        "#markup" => ", "
      ]
      "time" => array:1 [
        "#markup" => "All day"
      ]
    ]
  ]
  "#attributes" => array:1 [
    "class" => array:1 [
      0 => "smart_date_range"
    ]
  ]
  "#value" => "1746568800"
  "#end_value" => "1746914340"
]

Proposed resolution

Add a new key/value pair to the array like "all_day" => true/false.

Feature request
Status

Active

Version

4.2

Component

Code

Created by

🇩🇪Germany droprocker

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @droprocker
  • 🇨🇦Canada mandclu

    I think you could actually tell from the "datetime" value in the "#attributes" array. If it wasn't all day, the string would include the time. So, you can tell this is all day based on the length of this value.

Production build 0.71.5 2024