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

[Bug]: DateRange date_range.start is the day before the value selected in the control #2999

Open
olegam opened this issue Jan 10, 2025 · 2 comments
Labels
bug Something isn't working to-review Evidence team to review

Comments

@olegam
Copy link

olegam commented Jan 10, 2025

Describe the bug

The date_range.start is the day before the actual value selected. See below example where DateRange has a selection of Jan 1, 2024 - Dec 31, 2024, but the value of inputs.selected_date_range.start used in the query is 2023-12-31. I'm in the GMT+1 time zone.
Image

Steps to Reproduce

Here is the sample code to reproduce:

---
title: Date range bug
---

<DateRange
    name=selected_date_range
    title="Date Range"
    defaultValue='Last 12 Months'
/>

```sql filtered_orders
WITH sample_orders AS (
  SELECT * FROM (
    VALUES ('2023-12-31'::DATE, 'Customer A', 1500.00), ('2024-01-15'::DATE, 'Customer B', 2300.00),
      ('2024-01-28'::DATE, 'Customer C', 1800.00)
  ) AS t(date, customer_name, price)
)
SELECT * FROM sample_orders
WHERE date between '${inputs.selected_date_range.start}' and '${inputs.selected_date_range.end}'
ORDER BY date ASC
```

<DataTable data={filtered_orders} />

Logs

System Info

Severity

serious, but I can work around it

Additional Information, or Workarounds

No response

@olegam olegam added bug Something isn't working to-review Evidence team to review labels Jan 10, 2025
@olegam
Copy link
Author

olegam commented Jan 10, 2025

The problem also exists when using DateInput with range=true

@fsd-niraj
Copy link

I'd like to work on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working to-review Evidence team to review
Projects
None yet
Development

No branches or pull requests

2 participants