Single date field shows as long event.

Created on 27 February 2025, 4 months ago

Problem/Motivation

When I try to have a very simple content type (event node bundle with title and date field), and I use a past date, the date shows up

Steps to reproduce

  1. Create a new simplytest.me site, standard Drupal install, fullcalendar install
  2. Create a content type called "event" with a "datetime" field on it.
  3. Create an event node with a test title and date, say a few days in the past.
  4. Create a new view of event (Content) nodes, a page display, change the format to "FullCalendar", and add your event date field.
  5. Save your calendar and view it. The event you just created will start on the date you specify, but it will span all the days until the current day.

Proposed resolution

This appears to be related to these lines...

https://git.drupalcode.org/project/fullcalendar/-/blob/3.1.x/src/Plugin/...

Your event will not have an explicit END time, and will be marked as an ALL DAY event because of this. The line $end = new \DateTime(substr($event_end, 0, 10)); assume $event_end is set, but it's actually just an empty string here.

Throwing out an idea that we check if `$event_end` is a blank string, then we instead use `$event_start`?

Remaining tasks

??

User interface changes

??

API changes

??

Data model changes

??

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dpagini

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

Merge Requests

Comments & Activities

  • Issue created by @dpagini
  • πŸ‡ΊπŸ‡ΈUnited States dpagini
  • Merge request !57Resolve #3509432 "Single date field" β†’ (Merged) created by dpagini
  • Pipeline finished with Canceled
    4 months ago
    Total: 131s
    #435983
  • Pipeline finished with Canceled
    4 months ago
    Total: 84s
    #435986
  • Pipeline finished with Failed
    4 months ago
    Total: 206s
    #435987
  • Pipeline finished with Success
    4 months ago
    Total: 152s
    #435996
  • πŸ‡ΊπŸ‡ΈUnited States dpagini

    This MR works for the exact use case I specified, but I'm not sure how it would impact all the other uses of the calendar...

  • πŸ‡ΊπŸ‡ΈUnited States dbdrupal

    Thanks @dpagini. I have a use case that is very similar to this, however, there is a default duration for events. We run a youth sports league and all games are an hour in duration. The hour duration is common knowledge so we don't set an end date for the field. However, this doesn't play nice with the current version of FullCalendar. I would like to see (and it used to be there) a default duration added that can be set in the view to tell fullcalendar that if it does not see and end date, to add X number of hours to the start date.

  • Status changed to Needs review 26 days ago
  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    This fix is working for me.

    The code just uses the start date if the end date is empty.

    I don't know enough to verify further, but this seems better than how it currently is.

  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I have this problem in the calendar I set up too. Those events only have start dates because they represent a single moment in time, not a duration.

    To solve the problem I used the fix from πŸ› Hook not firing Active to add hook_fullcalendar_process_dates_alter() in a custom module and give all dates a duration of 1hr.

  • πŸ‡ΊπŸ‡ΈUnited States dcam
  • First commit to issue fork.
  • Pipeline finished with Skipped
    22 days ago
    #515455
  • Pipeline finished with Skipped
    22 days ago
    #515456
  • πŸ‡¨πŸ‡¦Canada mandclu

    Thanks for everyone's work here. I was able to replicate the problem, and verify that the proposed fix addressed it. I made a change to simplify the syntax, and merged it. I will try to roll a new release soon.

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

Production build 0.71.5 2024