Problem/Motivation

Since Drupal 10.3, the core DateTimeRangeFormatter has an option to show only the start or the end date of a DateTimeRange field. This option should be available in this module's formatter as well.

Proposed resolution

In OptionalEndDateDateTimeRangeTrait::viewElements(), use the new method renderStartEndWithIsoAttribute() instead of rendering the date ourselves.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mrshowerman created an issue. See original summary.

mrshowerman’s picture

Assigned: mrshowerman » Unassigned
Status: Active » Needs review
birk’s picture

Yes you are absolutely right!

This will break on sites using a core version older than 10.3.x so I'll make a new 2.x version of optional_end_date with these changes.

It's primary administrative work on my part, but I still need to find the time to do this.
Hopefully I'll get around to it soon.
I'm unsure of how the merge request works against a new branch, with credits and all. I'll make an update in this issue if I need you to update the merge request to keep credits, maybe it's all done automatically never tried it don't know.

mrshowerman’s picture

Issue summary: View changes

Thanks for the update!
Just let me know if you need help with the MR.

  • birk committed 6ca44819 on 2.0.x authored by mrshowerman
    Issue #3458951 by mrshowerman, birk: Add option to show only start or...
birk’s picture

Status: Needs review » Fixed

Thank you for the merge

I've created a new v2 branch, updated the core requirements and merged the request.

I'll try to find the time next week to make a v2 release so this gets out there. Thanks again for your code and patience.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

bryanmanalo’s picture

The module does allow empty end date.

However, on render for the formatter, even if end date is left empty, it displays both start and end date. It copies the value of the start date, and display that as the value for end date.

Is this expected? Any workaround?

birk’s picture

What version of optional end date and Drupal are you using?

bryanmanalo’s picture

I am using dev-1.x

bryanmanalo’s picture

Apologies, never mind. There was a custom twig on our end causing this.