influxdata / influxdata/influxdb
Quering using a date ignores setting of the location option
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__Steps to reproduce:__
```
import "timezone"
option location = timezone.location(name: "Europe/Amsterdam")
from(bucket: "iconnect")
|> range(start: 2022-12-24)
|> filter(fn: (r) => r["_measurement"] == "consumed_power_total1")
```
__Expected behavior:__
I expected the first sample to be of 00:00:00 using the specified timezone, just as if today() would have been used. When the specified date is today, today() could have been used, but when the date is an arbitrary date this is not possible.
Example output using 'start: today()':
```
consumed_power_total1 | value | 8664.062 | 2022-12-23T23:00:00.000Z | 2022-12-24T17:11:42.846Z | 2022-12-23T23:00:02.000Z
```
__Actual behavior:__
The first sample is of 00:00:00 using the UTC timestamp instead of the specified timezone.
Output using 'start: 2022-12-24':
```
consumed_power_total1 | value | 8665.122 | 2022-12-24T00:00:00.000Z | 2022-12-24T17:13:18.964Z | 2022-12-24T00:00:02.000Z
```
__Environment info:__
InfluxDB version: v2.4.0
Contributor guide
Research direction
Start by reproducing the Flux query using timezone.location(name: "Europe/Amsterdam"), range(start: 2022-12-24), and today() for comparison. Trace how the range date literal is evaluated relative to the configured location, then add a regression test showing that an arbitrary date begins at local midnight rather than UTC.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100