Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The need of having an option to display the event times in month view in my preferred format using the date formatting strings and characters given by Fullcalendar and momentJS
Proposed resolution
Add a field in the display fullcalendar_view settings to edit the timeFormat according Fullcalendar and MomentJS rules.
I join a patch in #2 that works correctly for me.
User interface changes
In Fullcalendar view display settings, find a new field labelled "Time Format settings for month view" in display section where you can edit at your own. If you leave it blank the time will be default formatted according Fullcalendar default.
Comment | File | Size | Author |
---|---|---|---|
#15 | fullcalendar_view-3053438-15.patch | 3.98 KB | Mingsong |
#5 | add-option-to-edit-timeformat-in-month-view-3053438-5.patch | 3.45 KB | DuaelFr |
#5 | interdiff-3053438.4.5.txt | 1.99 KB | DuaelFr |
Comments
Comment #2
pslcbs CreditAttribution: pslcbs commentedComment #3
MingsongThank you so much, @pslcbs
I will have a look a the patch attached.
Comment #4
DuaelFrThis is just a reroll on the last dev version.
Comment #5
DuaelFrThis patch
Comment #7
MingsongCommitted.
Thanks a lots for Edouard and Juan.
Comment #8
MingsongComment #9
MingsongComment #10
MingsongActually, there is a minor issue with the #5 patch in which the url placeholders.
I fixed it with the latest dev version.
Comment #11
DuaelFrWell done! I did not check this part while doing my last patch.
I'd have an other suggestion, though. When using placeholders for URLs, you should prefix them by ":" instead of "@" to ensure they are filtered.
@see \Drupal\Component\Render\FormattableMarkup::placeholderFormat()
Comment #12
MingsongThanks Edouard.
That is a really good point.
I am using the Url::fromUri() to create the URL and the placeholder is prefixed by '%'. I believe that there should be no security issue.
More details about output sanitisation:
https://www.drupal.org/docs/8/security/drupal-8-sanitizing-output
I also sanitise the user input by using Xss::filter()
The codes details are here:
https://git.drupalcode.org/project/fullcalendar_view/commit/099bb78
Comment #14
maxstarkenburgI'm wondering if this stopped working between 8.x-2.x and higher versions. I tried out the recommended version today (5.0.1), having not used this module before. No matter what I'm changing the value to in my View, it would seem that it's always outputting things in
h(:mm)a
format (I think ... my times in month view are showing as things like "4p" and "11:01a").Comment #15
MingsongThanks for reporting.
Here is the patch to fix it for version 5.0.1
Comment #16
MingsongReleased with 5.0.2