I wanted to truncate time and for that i wanted to use date.truncate() function of flux. I wanted to use the example given in the page:
import "date"
option now = () => 2021-04-21T20:30:00Z
date.truncate(t: -1h, unit: 1h)
// Should Return 2021-04-21T19:00:00Z
But it is giving error like : “type error @3:17-3:19: expected time but found duration”.
Any solution for this error or any alternative solution for what i want?
i am running in influxdb ui only. Sorry i made a mistake here, error it was giving everytime was - @0:0-0:0: option “v” depends on option “now”, which is defined in the same package
Yeah, runtime.version() doesn’t take any piped-forward data as input, so you shouldn’t include the |>. The fact that the UI injects this function with a pipe-forward operator is a known issue that is now fixed in InfluxDB Cloud and will be fixed in InfluxDB OSS when the next version releases.