-
Notifications
You must be signed in to change notification settings - Fork 153
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
Add a function to create a datetime from a Timeable
#4749
Comments
onelson
changed the title
Add a function to create a datetime from a
Add a function to create a datetime from a May 12, 2022
Timeable
.Timeable
This was referenced Jun 3, 2022
Rahul-Vasan
added a commit
to Rahul-Vasan/flux
that referenced
this issue
Jun 7, 2022
…any timeable into datetime (influxdata#4749) This feature addition now addresses the need for a function as part of the date package to be able to convert any Timeable into a datetime. fixes: influxdata#4749
2 tasks
2 tasks
Rahul-Vasan
added a commit
that referenced
this issue
Jun 14, 2022
…any timeable into datetime (#4749) (#4867) * feat(date): add builtin function time to the date package to convert any timeable into datetime (#4749) This feature addition now addresses the need for a function as part of the date package to be able to convert any Timeable into a datetime. fixes: #4749 * fix: modified buildinfo Modified buildinfo.gen.go to resolve the error with make checkgenerate * refactor: replaced _value with _time for readability * fix: Add documentation for location parameter Added documentation for location parameter in the date.flux file. This fixes make checkdocs * fix: modify buildinfo Modified buildinfo.gen.go to resolve the error with make checkgenerate
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Today, when
v.startTimeRange
is supplied to flux, it can be either aduration
ordatetime
.This can cause trouble for script authors who need to produce a datetime string from this value without knowing specifically which type the script will receive.
Use case
A use case for this is when you have a script that needs a datetime regardless of how the
v.startTimeRange
is specified.As a concrete example, if you were calling
sql.from()
and needed to string interpolate this value as ISO 8601 in your query to limit the returned rows, your script could only be written to support either relative (duration-based) values, or explicit datetime values.The script would need to be tweaked if your change the time range drop down in the UI, for example.
Proposal
Providing a function that can receive any
Timeable
and produce a datetime could solve for this situation.Example:
This also makes some sense for use with JSON APIs.
Note: there's a
getTimeableTime
function instdlib/date/date.go
which can be used to this aim.The text was updated successfully, but these errors were encountered: