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

Support time in date parameters #7418

Closed
petar777 opened this issue Apr 24, 2018 · 8 comments
Closed

Support time in date parameters #7418

petar777 opened this issue Apr 24, 2018 · 8 comments
Labels
.Completeness Querying/Native The SQL/native query editor Querying/Parameters & Variables Filter widgets, field filters, variables etc. Reporting/Dashboards Type:New Feature

Comments

@petar777
Copy link

petar777 commented Apr 24, 2018

Hello,

When I create a custom question I am capable of setting not only the date but the time in my date filter too. To be more precise- I choose the date column which I want to use. Then select "Between" from the drop-down menu where the user chooses the options of the date filter. Once there, I can set the date but beneath of the date, I can see an "Add Time" option. This feature works perfectly and is very useful...

However, if I want to create a more complex query and add a date variable or field filter, which I will later on control via the dashboard filter- I am not able to see the "Add Time" option no matter what I select from the drop-down menu.

Is it possible to manually select time from a dashboard filter or SQL field filter?

All the best :)

⬇️ Please click the 👍 reaction instead of leaving a +1 or update? comment

@mazameli
Copy link
Contributor

Thanks for pointing this out, @petar777. The "All Options" Date filter widget on dashboards should be exactly the same as the graphical query builder date filter, but it isn't:

screen shot 2018-04-24 at 10 03 32 am

screen shot 2018-04-24 at 10 03 47 am

@tlrobinson tlrobinson changed the title Date Filter has different features in custom question and dashboard Support time in date parameters Apr 24, 2018
@tlrobinson tlrobinson added .Limitation and removed Type:Bug Product defects labels Apr 24, 2018
@tlrobinson
Copy link
Contributor

This is primarily because we haven't come up with a way to serialize times in the query string. Ideally we'd only use "url safe" characters, i.e. a-zA-Z0-9._~-. Currently we use 2018-01-01 for dates, 2018-01-01~2018-02-01 for date ranges, etc.

Maybe something like 2018-01-1_1200 (noon, for example)

@salsakran salsakran added .Completeness Querying/Parameters & Variables Filter widgets, field filters, variables etc. and removed .Limitation labels Oct 29, 2019
@flamber flamber added the Querying/Native The SQL/native query editor label Nov 20, 2020
@jalada
Copy link

jalada commented Nov 23, 2020

This is primarily because we haven't come up with a way to serialize times in the query string. Ideally we'd only use "url safe" characters, i.e. a-zA-Z0-9._~-. Currently we use 2018-01-01 for dates, 2018-01-01~2018-02-01 for date ranges, etc.

Maybe something like 2018-01-1_1200 (noon, for example)

Genuine question, I'm probably missing some context; isn't that what percent encoding is for?

@ChristineChetty11
Copy link

ChristineChetty11 commented Apr 29, 2021

Is this feature coming still, has someone come up with a solution?
The time filter is very useful for our data and right now we're implementing a 'hack' job on the dashboard with a from hour and to hour..

@simon3p

This comment was marked as duplicate.

@cwilby
Copy link

cwilby commented Jul 27, 2021

A common approach I've seen is to base64 encode the parameters. Then you can use whatever transport format you like.

In JavaScript

const start = '2021-07-21T00:00:00.000Z';
const end = '2021-07-21T23:59:59Z';

const dateRangeFilter = encodeURIComponent(btoa(`${start}~${end}`));

fetch(`/query?dateRangeFilter=${dateRangeFilter}`, { method: 'POST' ... })

Produces /query?dateRangeFilter=MjAyMS0wNy0yMVQwMDowMDowMFp%2BMjAyMS0wNy0yMVQyMzo1OTo1OVo%3D

You could probably go down to millisecond level at that point with some tweaking.

@jdmaresco

This comment was marked as duplicate.

@mngr
Copy link

mngr commented Sep 13, 2024

This works at least in the last versions

@mngr mngr closed this as completed Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.Completeness Querying/Native The SQL/native query editor Querying/Parameters & Variables Filter widgets, field filters, variables etc. Reporting/Dashboards Type:New Feature
Projects
None yet
Development

No branches or pull requests