Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"last n" timeDimension range short by 1 day for n > 1 #3451

Open
datananda opened this issue Sep 17, 2021 · 2 comments
Open

"last n" timeDimension range short by 1 day for n > 1 #3451

datananda opened this issue Sep 17, 2021 · 2 comments
Labels
bug good first issue help wanted

Comments

@datananda
Copy link

@datananda datananda commented Sep 17, 2021

Describe the bug
Running a "last n months" timeDimension query returns a dateRange that is short by 1 date when n > 1.

To Reproduce

  1. Queries are tested against a DimDates Cube schema (1 row per date, no missing dates).
  2. Run 'last month' query:
{
  "dimensions":[
    "DimDates.shortDate"
  ],
  "timeDimensions":[
    {
      "dimension":"DimDates.shortDate",
      "dateRange":"last month",
      "granularity":"month"
    }
  ]
}
  1. Observe the dateRange in the response as expected:
"timeDimensions": [
    {
        "dimension": "DimDates.shortDate",
        "dateRange": [
            "2021-08-01T00:00:00.000",
            "2021-08-31T23:59:59.999"
        ],
        "granularity": "month"
    }
],
  1. Run 'last 2 months' query:
{
  "dimensions":[
    "DimDates.shortDate"
  ],
  "timeDimensions":[
    {
      "dimension":"DimDates.shortDate",
      "dateRange":"last 2 months",
      "granularity":"month"
    }
  ]
}
  1. Observe the dateRange in the response end date is shorted by 1 day:
"timeDimensions": [
    {
        "dimension": "DimDates.shortDate",
        "dateRange": [
            "2021-07-01T00:00:00.000",
            "2021-08-30T23:59:59.999"
        ],
        "granularity": "month"
    }
],

Expected behavior
Expect the dateRange in the response of 'last 2 months' query to be:

"timeDimensions": [
    {
        "dimension": "DimDates.shortDate",
        "dateRange": [
            "2021-07-01T00:00:00.000",
            "2021-08-31T23:59:59.999"
        ],
        "granularity": "month"
    }
],

Screenshots
If applicable, add screenshots to help explain your problem.

Version:
"@cubejs-backend/cubestore-driver": "^0.27.2",
"@cubejs-backend/postgres-driver": "^0.27.2",
"@cubejs-backend/server": "^0.27.3",
"@cubejs-backend/serverless": "^0.27.3",
"@cubejs-backend/serverless-aws": "^0.27.3",

Additional context
Add any other context about the problem here.

@paveltiunov paveltiunov added bug help wanted good first issue labels Sep 20, 2021
@github-actions
Copy link

@github-actions github-actions bot commented Sep 20, 2021

If you are interested in working on this issue, please leave a comment below and we will be happy to assign the issue to you.
If this is the first time you are contributing a Pull Request to Cube.js, please check our contribution guidelines.
You can also post any questions while contributing in the #contributors channel in the Cube.js Slack.

@JoshMentzer
Copy link
Contributor

@JoshMentzer JoshMentzer commented Sep 29, 2021

hey @datananda ,
I believe this was fixed in #2824

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue help wanted
Projects
None yet
Development

No branches or pull requests

3 participants