DateTimeRange does not return start_date/end_date if dates are the same

Created on 28 September 2017, about 7 years ago
Updated 27 December 2023, 12 months ago

If you create a DateTime Range field with the exact same DateTime for both Start and End, the field does not return a DateTimeRange object when returning the value in views or field displays, but only returns a single date object.

I don't know if this is by design, but if so it would be nice if there would be an option to always return start/end date pairs for consistent formatting options.

Example in Views display:

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
DatetimeΒ  β†’

Last updated 6 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States diamondsea

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain rcodina Barcelona

    The patch needs to update DateRangePlainFormatter.php too as said in #6. However, the DateRangeDefaultFormatter.php no longer needs to be updated.

    I agree with #4 that the actual frontend behavior is fine. However, I think the main problem we are facing here is that when one needs to customize the output of range date fields on Twig templates, it's not usable to have to check out whether the start_date and the end_date are set or not. This forces you to write complex Twig code that one wouldn't want to write.

Production build 0.71.5 2024