Skip to content

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

@olegam

Description

@olegam

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingto-reviewEvidence team to review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions