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.
Hi,
From a fresh calendar view, I have a very strange behavior : all events positioned on Sunday do not appear in the Week display.
- Month display : Right (see 'Calendar month - settings' and 'Calendar month - preview')
- Week display : Wrong (see 'Calendar week - settings' and 'Calendar week - preview')
Note : Monday is the first day of the week.
Thanks for help !
Comment | File | Size | Author |
---|---|---|---|
Calendar week - preview.jpg | 127.65 KB | brulain | |
Calendar week - settings.jpg | 146.65 KB | brulain | |
Calendar month - preview.jpg | 173.61 KB | brulain | |
Calendar month - settings.jpg | 145.4 KB | brulain |
Comments
Comment #2
brulain CreditAttribution: brulain commented[UPDATE]
If I change the first day o the week from Monday to Sunday, the events planned on Sunday appear, but not those planned on Saturday. It looks like Calendar/Week cannot display events scheduled on the last day of the week. In other words, a week would contain only 6 days.
Comment #3
remyarose CreditAttribution: remyarose commentedIn week calender view query is displaying from start date 00:00:00 to end date 00:00:00.
It need to take start date 00:00:00 to end date 23:59:59.That is the reason it skipping last day in the week
Comment #4
brulain CreditAttribution: brulain commentedThanks for your answer!
So, what do I have to do?
Best
Comment #5
remyarose CreditAttribution: remyarose commentedYou can alter that calendar week view query with hook_views_query_alter() through a custom module
function calendar_alter_views_query_alter(&$view, &$query) {
if ($view->name == 'calendar' && $view->current_display == 'page_2') {
$query->where['date']['conditions'][0]['field']="DATE_FORMAT(field_data_field_date.field_date_value, '%Y-%m-%d') >= :node_date_argument AND DATE_FORMAT(field_data_field_date.field_date_value, '%Y-%m-%d') <= :node_date_argument1";
}
}
Reference : http://tylerfrankenstein.com/code/drupal-7-how-modify-views-query-custom...
Comment #6
brulain CreditAttribution: brulain commentedThanks a lot remyarose, it works great now !
Comment #7
thtas CreditAttribution: thtas commentedI'm having the same problem except the events aren't showing on any Saturdays in week view.
Is this something to do with localised php settings around first day of week? or is it simply that the query is not including the entire day of the final day.
Comment #8
bneil CreditAttribution: bneil at The University of Iowa commentedI'm setting this is a duplicate of #1779142: No items are shown in 7th day in the week view for now, although I think it may ultimately be fixed in the work being done in #1137062: date_week_range and date_iso_week_range both returns 1 day too much..