Needs work
Project:
Fullcalendar View
Version:
5.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Jun 2018 at 20:14 UTC
Updated:
6 Sep 2024 at 22:12 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
johnny5th commentedI took a shot at this. It's a little rough, but it checks the start/end times for 00:00 and 23:59 to make it all day.
Comment #3
extect commentedThanks for the patch! Took my quite some time to get back to this feature request, but the patch is still working in latest 2.x-dev!
I was wondering if it wasn't better to treat events as full-day events where start and end times are both set to a 0:00 instead of requiring the end time to be 23:59. With 0:00 as end time you would be able to leave the time fields just empty (Drupal will fill them with 0:00 automatically) and you would not be required to set the granularity of your date field to be 1min in order to be able to enter an end time of 23:59.
Comment #4
extect commentedComment #5
mingsongGreat work. Thanks guys so much.
I will test it when I have a chance.
Comment #6
michaelschutz commentedJust coming back to this - the patch still works on the new 2.0 stable release. It's a great help to me so that I can use all-day functionality in the calendar within one Date Range field in my event content type. So thank you!
Comment #7
pushpinderchauhan commentedI was also facing this issue and came across this thread. In my case, I've been using All Day (https://www.drupal.org/project/date_all_day) feature, so an author can choose either All day checkbox or enter both dates manually. IMO, having both the options in the code would help to manage the "All Day" feature efficiently, hence uploading a revised patch here.
Comment #8
jwilson3I've tested patch in #7 and it works great, however I'm using both Date_All_Day AND Optional_End_Date module, which is not supported by patch in #7, so this patch continues the good work on previous patches and adds this case as well.
The current patch works in the following cases:
0000in code.nullor empty (which is achievable using Optional_End_Date or core patch from #2794481: Allow end date to be optional).0000in code.2359in code (which is achievable using Date_All_Day module).Comment #9
dmundraThanks for the patch @jwilson3. I created one for the 5.x branch.
Comment #10
matt_paz commentedUsing patch #9 with smart_date 3.0 results provides an error as follows:
Comment #11
dmundra@matt_paz it looks like the smart_date module is using Unix timestamp e.g. 1621350000. I am not sure but I think that DateTime is expecting specifically for the calculation of all-day events as it is expecting an ISO timestamp. I think you need the patch from 3061341 and modify the patch for all-day events
Comment #12
matt_paz commented@dmundra - Ya, it looks like smart_date works without any additional patches right now after all. I didn't realize it before looking into this patch. At this stage, I just thought you might want to know that it doesn't work with the patch above. Thanks for circling back either way!
Comment #13
dmundraSounds good @matt_paz.
Comment #14
mandclu commentedI think we should be cautious about adding code that has been found to create errors in a popular existing combination with FCV, as identified by @matt_paz. Let me take a stab at adding a check for a timestamp to see if that fixes it.
Comment #15
mandclu commented@dmundra Smart Date does indeed use timestamps, and provides its own FullcalendarViewProcessor plugin to pass in the data in a format that FCV can use. Provided nothing will choke on a timestamp before it gets a chance, of course. ;)
Here's a modified version of your code, wrapping the changes in a check to make sure the start isn't numeric.
Comment #16
dmundraThanks, @mandclu. That solution works great.
Comment #17
becw commentedI've rerolled the patch from #15 for the 5.x branch.
Comment #18
singularoNeeded to fix double utc conversion and the daterange type to get it to work for me.
Comment #19
marthinal commentedI'm upgrading to fullcalendar_view 5 and #17 works as expected. The calendar is broken with #18. I'm using date_all_day and optional_end_date.
Comment #20
mingsongI close it as 8.x branch is not supported anymore.
Which means the new feature quested won't be consider anymore.
Comment #21
lpeabody commentedRe-opened because the patch in #17 was re-rolled against the 5.x branch and the feature request is still valid (5.x doesn't support all-day functionality for a single day).
Comment #22
sacarney commentedIs this feature request meant to address the undesired display of a time on All Day events? If the event is All Day, I don't want the time (12:00AM) to appear on the event in the calendar.
Comment #23
chrisckWhile the original issue summary does not mention using smart_date for all day functionality, smart_date is mentioned quite a few times in the comments. I'm reporting that smart_date 4.0.2 is working out of the box with fullcalendar_view 5.1.12 with all day functionality, without requiring any patches.
Perhaps what some are missing is that the field type has to be "Smart date range" and not, the core "Date range" with Smart date widget.
Download and enable the Smart Date Calendar Kit on a new Drupal install and look at how it's configured.
Comment #24
geekygnr commentedThis patch causes warnings if the end date is not set.
Comment #25
geekygnr commentedHere is a new patch. Adds some checks for empty values and addressed some phpcs issues.
Comment #26
leoenriquezp commentedI updated the patch that @geekygnr left in comment #25 to be compatible with the latest version
5.1.13Comment #27
ferminaguilar commented@LeonelEnriquez98 The patched worked for the most part but its posting two days. So I post an event for 1 day 11/20 but when viewing it's showing all day for 11/19 and all day 11/20 for the same event. I just added the start date only and also did the same day for Start and End date fields and still the same issue.
Comment #28
leoenriquezp commented@ferminaguilar I could reproduce that error. It was related to the
timezonevariable. So here I leave the new patch.Comment #29
jennine commented@ferminaguilar @LeonelEnriquez98 I still had the same issue with all-day events starting on the day before they should after applying patch #28. I believe the issue is because when finding the start date, it applies the difference from UTC to a date which has already had the difference applied to it. So it applies the timezone difference twice. Here's a new patch.
Comment #30
leoenriquezp commented@jennine Your patch seems to be working fine. Thanks!
Comment #31
xpersonas commentedPatch #30 fixed the starting a day early for me... but now they are running a day over. My events are pulled from Google. It seems this patch adds an extra day to my events.
Attaching the patch that works for me, but I'm not sure if this just solves my use case.
Changing:
$end = $timezone_service->utcToLocal(empty($end_date) ? $start_date_value : $end_date, $timezone, 'Y-m-d', '1 day');To:
$end = $timezone_service->utcToLocal(empty($end_date) ? $start_date_value : $end_date, $timezone, 'Y-m-d');Comment #32
xpersonas commentedComment #33
luenemannThis reverts changes from #3215767: Entries always rendered with the field selected timezone. But that removes support for datetime and daterange formatters.
timezoneis a setting of timestamp formatter.This should be fixed in a separat issue to support both formatters.
This change removes support for
daterange_plainanddaterange_customformatters. It should be reverted.Needs work for 2.
Comment #37
mortona2k commentedRebased on 5.x and cleaned up a section with different checks on $options.