Problem/Motivation

I'm not sure from which version on this bug appears, but on 2.0.2 at least everything worked. After an update to the most current version (which is at the moment 2.0.5) the pagination doesn't work anymore.

Steps to reproduce

Reproduction steps not even necessary, the bug can be seen on the official demo site as well: https://magnificent-caramel-9d8164.netlify.app/events-calendar/
Clicking on the next or previous month doesn't do anything.

But just to be complete: I guess there's nothing special to do to be able to reproduce it. Just create a calendar view as described in the documentation. It doesn't seem to depend on any specific configuration combination.

Environment:
- Drupal: 9.5.4
- PHP: 8.1.13

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

alex0412 created an issue. See original summary.

matthieuscarset’s picture

Thank you for reporting this issue. I am not sure to understand though.

Are you talking about the navigation by month or another pager ?

If you view uses Ajax, any error in the console ?

Can you share more info about how your view is configured ?

Regarding the demo, it s a static site and no dynamic things such as the pager or search work. There should be a disclaimer to explain it, sorry about that.

mornel’s picture

I've just installed version 2.0.5 and I am experiencing the same problems described by alex0412 above.

Drupal version: 10.0.4
PHP: 8.1.14

Pagination doesn't work both on demo calendars and manually created. Turning AJAX on/off doesn't change anything.

To be more exact you can just do one step. For example from main view page you can go back one month, but then doesn't matter if you click on previous, next month or today - nothing happens.

matthieuscarset’s picture

Status: Active » Postponed (maintainer needs more info)

Thank you very much for reporting this issue too.

I am trying hard but I really don't manage to reproduce any error with the pagination.

I need to know what is the configuration of your Views @mornel @alex0412.

Can you please detail how is your Calendar view configured?
Type of content.
Calendar settings.
Field settings.
Filters...etc

Maybe just a copy/paste of the views.view.your_view_id.yml would be enough for me to understand.

Lookin forward to hearing from you.

ttnt’s picture

Same problem here on a fresh install of D10. With or without AJAX doesn't matter, you can go forwards or backwards once, then it's over.

Content type uses a Date range field.
Settings: all default, date field is my date range field.
No filters.
Field settings: in the view I didn't change them.

No errors are logged. Report/status is all green.
I can screenshot all the configuration pages if that's helpful?

Edit: adding my config. Also tried a view with only my date field but that gave the same result. This one has a couple more fields as I already assumed the module worked fine :).

uuid: 43fd8cd5-f16d-4795-a718-8dcf44a4c825
langcode: en
status: true
dependencies:
  config:
    - field.storage.node.field_comments
    - field.storage.node.field_range_date
    - field.storage.node.field_reservable
    - node.type.reservation
  module:
    - calendar_view
    - datetime_range
    - node
    - user
id: reservation_calendar
label: 'Reservation calendar'
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
display:
  default:
    id: default
    display_title: Default
    display_plugin: default
    position: 0
    display_options:
      title: 'Reservation calendar'
      fields:
        title:
          id: title
          table: node_field_data
          field: title
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: node
          entity_field: title
          plugin_id: field
          label: ''
          exclude: true
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: false
            ellipsis: false
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: string
          settings:
            link_to_entity: true
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
        uid:
          id: uid
          table: node_field_data
          field: uid
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: node
          entity_field: uid
          plugin_id: field
          label: ''
          exclude: true
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: target_id
          type: entity_reference_label
          settings:
            link: true
          group_column: target_id
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
        field_comments:
          id: field_comments
          table: node__field_comments
          field: field_comments
          relationship: none
          group_type: group
          admin_label: ''
          plugin_id: field
          label: ''
          exclude: true
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: string
          settings:
            link_to_entity: false
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
        field_range_date:
          id: field_range_date
          table: node__field_range_date
          field: field_range_date
          relationship: none
          group_type: group
          admin_label: ''
          plugin_id: field
          label: ''
          exclude: true
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: daterange_default
          settings:
            timezone_override: ''
            format_type: medium
            separator: '-'
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
        view_node:
          id: view_node
          table: node
          field: view_node
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: node
          plugin_id: entity_link
          label: ''
          exclude: true
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          text: view
          output_url_as_text: true
          absolute: false
        delete_node:
          id: delete_node
          table: node
          field: delete_node
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: node
          plugin_id: entity_link_delete
          label: ''
          exclude: true
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          text: delete
          output_url_as_text: true
          absolute: false
        edit_node:
          id: edit_node
          table: node
          field: edit_node
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: node
          plugin_id: entity_link_edit
          label: ''
          exclude: true
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          text: edit
          output_url_as_text: true
          absolute: false
        field_reservable:
          id: field_reservable
          table: node__field_reservable
          field: field_reservable
          relationship: none
          group_type: group
          admin_label: ''
          plugin_id: field
          label: ''
          exclude: true
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: target_id
          type: entity_reference_label
          settings:
            link: true
          group_column: target_id
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
        nothing:
          id: nothing
          table: views
          field: nothing
          relationship: none
          group_type: group
          admin_label: ''
          plugin_id: custom
          label: ''
          exclude: false
          alter:
            alter_text: true
            text: "<div class=\"calendaritems calendarreservable\">{{ field_reservable }}</div>\r\n<div class=\"calendaritems calendarauthor\">{{ uid }}</div>\r\n<div class=\"calendaritems calendardate\">{{ field_range_date }}</div>\r\n<div class=\"calendaritems calendarcomments\">{{ field_comments }}</div>\r\n<div class=\"calendaritems calendarlinks\"><a href=\"{{ view_node }}\" class=\"calendarbutton\"><i class=\"material-icons\">visibility</i></a><a href=\"{{ edit_node }}\" class=\"calendarbutton\"><i class=\"material-icons\">edit</i></a><a href=\"{{ delete_node }}\" class=\"calendarbutton\"><i class=\"material-icons\">delete_forever</i></a></div>"
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: false
      pager:
        type: calendar
        options:
          offset: 0
          month_date_format: F
          display_reset: 1
      exposed_form:
        type: basic
        options:
          submit_button: Apply
          reset_button: false
          reset_button_label: Reset
          exposed_sorts_label: 'Sort by'
          expose_sort_order: true
          sort_asc_label: Asc
          sort_desc_label: Desc
      access:
        type: perm
        options:
          perm: 'access content'
      cache:
        type: tag
        options: {  }
      empty: {  }
      sorts:
        created:
          id: created
          table: node_field_data
          field: created
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: node
          entity_field: created
          plugin_id: date
          order: DESC
          expose:
            label: ''
            field_identifier: ''
          exposed: false
          granularity: second
      arguments: {  }
      filters:
        status:
          id: status
          table: node_field_data
          field: status
          entity_type: node
          entity_field: status
          plugin_id: boolean
          value: '1'
          group: 1
          expose:
            operator: ''
        type:
          id: type
          table: node_field_data
          field: type
          entity_type: node
          entity_field: type
          plugin_id: bundle
          value:
            reservation: reservation
      style:
        type: calendar
        options:
          grouping: {  }
          row_class: ''
          default_row_class: true
          calendar_display_rows: 0
          calendar_fields:
            field_range_date: field_range_date
          calendar_weekday_start: '1'
          calendar_sort_order: ASC
          calendar_timestamp: 'this month'
      row:
        type: fields
      query:
        type: views_query
        options:
          query_comment: ''
          disable_sql_rewrite: false
          distinct: false
          replica: false
          query_tags: {  }
      relationships: {  }
      use_ajax: true
      header: {  }
      footer: {  }
      display_extenders: {  }
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - 'user.node_grants:view'
        - user.permissions
      tags:
        - 'config:field.storage.node.field_comments'
        - 'config:field.storage.node.field_range_date'
        - 'config:field.storage.node.field_reservable'
  page_1:
    id: page_1
    display_title: Page
    display_plugin: page
    position: 1
    display_options:
      display_extenders: {  }
      path: reservation_calendar
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - 'user.node_grants:view'
        - user.permissions
      tags:
        - 'config:field.storage.node.field_comments'
        - 'config:field.storage.node.field_range_date'
        - 'config:field.storage.node.field_reservable'
matthieuscarset’s picture

StatusFileSize
new8.46 MB

TY very much for this example.

I have created a node:reservation with field_comments, field_range_date and field_reservable and then, I have imported your View. Finally, I have generated a few nodes with devel_generate (e.g. 20+ node:reservation in the past year).

I can navigate correctly between months without any error being raised.

I am sorry for the inconvenience but I do not manage to reproduce the bug you're having.

I'd need more details about the error.

Any log from Drupal or in your browser's console maybe?

If you have access to the code, can you try to debug step by step in template_preprocess_calendar_view_pager()?

Are you using any custom Twig template for this View, at all? Can you try with a different theme?

Looking forward to hearing from you.

ttnt’s picture

Hello,
I tried changing to the default theme and also enabled/disabled AJAX for the heck of it, no change.
Debugging... I tried looking up how but it seems like a bit of a deep dive for me. I have created modules before but I'm a bit of an amateur... I guess I'd have to use devel and wrap it in kint or something? I got a bit lost in the whole debugging using an IDE :/.
There are ZERO errors on the Drupal / apache side of things.

Anyway, trying to do some hardcore notepad work here:

March
next:
reservation_calendar?previous=1675759899&current=1678179099&next=1680853899&date_format=custom&date_pattern=F&display_reset=1&calendar_timestamp=1680853899
prev:
reservation_calendar?previous=1675759899&current=1678179099&next=1680853899&date_format=custom&date_pattern=F&display_reset=1&calendar_timestamp=1675759899

April
reservation_calendar?previous=1675759899&current=1678179099&next=1680853899&date_format=custom&date_pattern=F&display_reset=1&calendar_timestamp=1680853899
next:
reservation_calendar?previous=1678179099&current=1680853899&next=1683445899&date_format=custom&date_pattern=F&display_reset=1&calendar_timestamp=1680853899
prev:
reservation_calendar?previous=1678179099&current=1680853899&next=1683445899&date_format=custom&date_pattern=F&display_reset=1&calendar_timestamp=1680853899

So when I take the next value and type in the following in my browser I go to May:
reservation_calendar?calendar_timestamp=1683445899

So the problem seems to be the "calendar_timestamp" part? If I give the next or previous timestamps (as correctly predicted by the next and previous buttons) along in the URL it correctly moves to the next Month, but then gets stuck again as it again puts the current month timestamp in the URL of the next or previous month.

I hope this can help :)

luluthegeek’s picture

I am experiencing the same problems with a fresh install of Drupal 9.5.4 and calendar_views 2.0.5.

I can change month once with the pager, but then any new action is not successful and I stay on the same month. The previous, next and today links on the pager all have the same URL :

evenements?previous=1675799408&current=1678218608&next=1680893408&date_format=custom&date_pattern=F&display_reset=1&calendar_timestamp=1680893408

I have this problem with the themes Olivera and Claro, and AJAX enabled or disabled.

Also tested using the Article content type and the field "created". I post an export of my view below.

Thank you for your help...

uuid: 524985ad-93c1-48ed-addb-d710af3d70f7
langcode: fr
status: true
dependencies:
  config:
    - node.type.article
  module:
    - calendar_view
    - node
    - user
id: events
label: events
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
display:
  default:
    id: default
    display_title: Default
    display_plugin: default
    position: 0
    display_options:
      title: events
      fields:
        title:
          id: title
          table: node_field_data
          field: title
          relationship: none
          group_type: group
          admin_label: ''
          plugin_id: field
          label: ''
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: true
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: string
          settings:
            link_to_entity: true
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
        created:
          id: created
          table: node_field_data
          field: created
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: node
          entity_field: created
          plugin_id: field
          label: ''
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: timestamp
          settings:
            date_format: medium
            custom_date_format: ''
            timezone: ''
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
      pager:
        type: calendar
        options:
          offset: 0
          month_date_format: F
          display_reset: 1
      exposed_form:
        type: basic
        options:
          submit_button: Appliquer
          reset_button: false
          reset_button_label: Réinitialiser
          exposed_sorts_label: 'Trier par'
          expose_sort_order: true
          sort_asc_label: Asc
          sort_desc_label: Desc
      access:
        type: perm
        options:
          perm: 'access content'
      cache:
        type: tag
        options: {  }
      empty: {  }
      sorts:
        created:
          id: created
          table: node_field_data
          field: created
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: node
          entity_field: created
          plugin_id: date
          order: DESC
          expose:
            label: ''
            field_identifier: ''
          exposed: false
          granularity: second
      arguments: {  }
      filters:
        status:
          id: status
          table: node_field_data
          field: status
          entity_type: node
          entity_field: status
          plugin_id: boolean
          value: '1'
          group: 1
          expose:
            operator: ''
            operator_limit_selection: false
            operator_list: {  }
        type:
          id: type
          table: node_field_data
          field: type
          entity_type: node
          entity_field: type
          plugin_id: bundle
          value:
            article: article
          expose:
            operator_limit_selection: false
            operator_list: {  }
      style:
        type: calendar
        options:
          grouping: {  }
          row_class: ''
          default_row_class: true
          calendar_display_rows: 0
          calendar_fields:
            created: created
          calendar_weekday_start: '1'
          calendar_sort_order: ASC
          calendar_timestamp: 'this month'
      row:
        type: fields
      query:
        type: views_query
        options:
          query_comment: ''
          disable_sql_rewrite: false
          distinct: false
          replica: false
          query_tags: {  }
      relationships: {  }
      use_ajax: true
      header: {  }
      footer: {  }
      display_extenders: {  }
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - 'user.node_grants:view'
        - user.permissions
      tags: {  }
  page_1:
    id: page_1
    display_title: Page
    display_plugin: page
    position: 1
    display_options:
      display_extenders: {  }
      path: events
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - 'user.node_grants:view'
        - user.permissions
      tags: {  }
matthieuscarset’s picture

Status: Postponed (maintainer needs more info) » Active

Thank you for reporting the issue with details.

I am still trying to reproduce the error. I've made a fresh install on Drupal 9.5.3 with version 2.0.5.

Installed calendar_view_demo and tested the Editorial calendar view.

Pagination links work all the time, even after multiple clicks, meaning the current timestamp is correct in parameters.

Trying to investigate in code directly but I can't figure out what cause your issue with the timestamp.

ttnt’s picture

Is there a chance it's a Drupal 9.5.4 thing? My test was on 10.0.4. And perhaps as not everyone is reporting the issue it's a recent thing?

alex0412’s picture

Issue summary: View changes
alex0412’s picture

I disabled all caches just to make sure that it's not related to that, but the issue is still there.

alex0412’s picture

I think I have found the bug.

It's inside the "template_preprocess_calendar_view_pager" preprocess function, where the query params are "merged" with the correct "calendar_timestamp" param for the next/prev/reset link:

'#url' => Url::fromRoute($route_name, [], [
  'query' => $parameters + ['calendar_timestamp' => $parameters['next']],
]),

The order of this "+" operator is wrong. PHP documentation:

The + operator returns the right-hand array appended to the left-hand array; for keys that exist in both arrays, the elements from the left-hand array will be used, and the matching elements from the right-hand array will be ignored.

As the "calendar_timestamp" key was already inside $parameters, the intended override didn't work. The fix is easy, just revert the order.

Why you can't reproduce this bug @matthieuscarset is weird though...

luluthegeek’s picture

I think the bug appeared with the update from Drupal 9.5.3 to 9.5.4.

I downgraded my Drupal 9.5.4 to 9.5.3 and installed calendar_view_demo : all is working fine, and the links in the pager are ok :

- next link : /calendar?created=-1%20year&title=&type=All&status=All&langcode=All&previous=1680300000&current=1682892000&next=1685570400&date_format=custom&date_pattern=F&display_reset=1&calendar_timestamp=1685570400

- reset link : /calendar?created=-1%20year&title=&type=All&status=All&langcode=All&previous=1680300000&current=1682892000&next=1685570400&date_format=custom&date_pattern=F&display_reset=1&calendar_timestamp=1677625200

- previous link : /calendar?created=-1%20year&title=&type=All&status=All&langcode=All&previous=1680300000&current=1682892000&next=1685570400&date_format=custom&date_pattern=F&display_reset=1&calendar_timestamp=1680300000

Then, I updated Drupal 9.5.3 to 9.5.4, and the bug appeared again on calendar_view_demo.

alex0412’s picture

Ah, that's interesting! Maybe this commit from 9.5.4 is related to it, at least it's about view pagers: https://git.drupalcode.org/project/drupal/-/commit/3664a3d4b49f900f617d9...

tar_inet made their first commit to this issue’s fork.

pfructuoso’s picture

I tried in Drupal 9.5.2 and I can´t replicate it either but I did in 9.5.4.

Fix #13 makes sense and works to me so I created a PR from it to help on the process. I added @alex0412 in the comment of the commit to make sure he gives attribution
https://git.drupalcode.org/project/calendar_view/-/merge_requests/12

kenrbnsn’s picture

I applied the diff code (patch) to my site and it fixed the problem. Drupal: 9.5.4, PHP 8.1.16

pfructuoso’s picture

Status: Active » Reviewed & tested by the community
jurgenhaas’s picture

+1 RTBC on #13, this fixes the problem for me too and I was just about to propose the exact same patch.

matthieuscarset’s picture

Status: Reviewed & tested by the community » Fixed

Woua thank you very much all for finding and fixing the issue. I definitely did not manage to reproduce it...

I'm merging the changes and it will be shipped in a new release soon.

mornel’s picture

Thank you guys, works for me too @ Drupal 10.0.4!

Small suggestion: it would be nice to have a class on the current day. Cheers!

matthieuscarset’s picture

I reproduced the bug locally yesterday while working on this other issue.

I have fixed the pagination by changing some things in the way we retrieve the calendar timestamp (e.g. getCalendarTimestamp() method).

The final fixed version will be release soon - depends on the other issue.

attisan’s picture

I'm a bit at a loss here. using the latest dev the issue is still present (running core 9.5.5) - but the patch from MR 12 does not apply (I guess as it is already been merged?).

##edit: same with core 9.5.7. My finding is: navigating into the future works fine. However, navigating backwards works a single time after which the headers are wrong and navigation stalls. navigating into the future somewhat resolves the issue (but jumps over a month).

I will be looking into this as we need this for a client 😅

attisan’s picture

@mornel

Small suggestion: it would be nice to have a class on the current day. Cheers!

see #3351841: Add weekday classes and week numbers. Would love some reviews 🙏.

Status: Fixed » Closed (fixed)

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