Skip to content

Pagy::VariableError in ReceivablesController#index expected :period to be a an Array of min and max local Time instances; #38

@Pauloparakleto

Description

@Pauloparakleto

Pagy::VariableError in ReceivablesController#index
expected :period to be a an Array of min and max local Time instances; got [2022-12-30 00:00:00 -0300, 2022-12-29 00:00:00 -0300]

Steps to reproduce:

  1. Create an account receivable;
  2. Create an account receivable whose date is before the first one from step 1.
  3. Go to receivable index page.

Also reproducible when it updates the last account receivable create with a date before the first receivable created.

From the exception on the pagy gem:

raise VariableError.new(self, :period, 'to be a an Array of min and max local Time instances', @vars[:period]) \
            unless @starting.is_a?(Time) && @ending.is_a?(Time) && !@starting.utc? && !@ending.utc? && @starting <= @ending

Thus, @starting date must be less than or equal to @ending date

Screenshot from 2023-01-14 16-25-12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions