-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow filtering with date/time properties #6619
Comments
@mariusandra fwiw I think we should also prioritize this as part of the effort in improving the UX around filtering we talked about today |
There's a plugin as a stopgap: https://posthog.com/plugins/timestamp-parser |
Some context from a user on Slack, this is becoming increasingly important to support natively. It's quite unintuitive that you can't handle dates properly in the app. |
Agree that we should prioritize this. It's kind of a dead end for less-technical users. I already have a partial design done, but I can put that back into my rotation if we think we have capacity for this in the near future. |
Bumping again as this was brought up in the users slack today. |
There seem to be two relatively quick concrete things in here
(there are other things but these seem to have good bang per buck) |
Marius's suggestions
(store date formats against properties so they can be passed to clickhouse?) |
There are few points that we discussed:
|
Agree with this direction - the core change is presenting dates in a format that is meaningful to the user. Maybe this could be a project-level setting for setting a data format preference, then we can default all dates to that format. |
The UTC thing is definitely important but not as important IMO as the filter support. If I can filter users who signed up before/after X time, if I have some timezone wonkiness it'll be a minor setback vs. a complete blocker. From a UX standpoint, I would suggest if we could automatically recognize either UNIX timestamps or ISO-8601 date strings (whether date or date/time) and automatically query them on the fly. |
Braindumping some thoughts
ClickHouse can do some parsing when selecting strings that we know are dates
So if we constrain the input string formats we can query the strings as dates without any processing and take advantage of the built-in date and time functions Where we can't constrain the input (and we won't always be able to) we can convert some values with simple processing e.g. ISO8601 ending in Z we know is in UTC so
Since the user has provided a format we can exclude items that don't match that format at query time e.g.
Since we can detect incorrect formatting on event properties in order to exclude them, we could also warn the user about them... although that might be frustrating if there's no onward journey for the user to edit or remove bad data So we could allow someone to say that property X is a DateTime with one of a list of allowed formats. We can look that up from Postgres before querying in ClickHouse, and then convert the item to DateTime as we query |
So...
returns So, if we can detect, or allow the user to provide, a timezone we can use that when querying and generating results |
There are built-in ClickHouse functions e.g.
returns
Once we know a particular property is a date we can add queries that take advantage of that |
It seems like a reasonable first step is letting (paid?) customers specify that particular properties are DateTime with a choice from a constrained format list of YYYY-MM-DD, YYYY-MM-DD hh:mm:ss, ISO 8601 UTC, and UNIX timestamp. And picking a single use-case to provide on top of that... Maybe querying from the Taxonomic Breakdown Filter for same time, same date, before, and after That feels like a good step to get feedback on and a starting point for more complex capabilities |
One more request / +1 for this feature, with our use case below if that helps - Slack thread here. We are Pro users :)
|
ClickHouse
|
This issue has 2002 words at 17 comments. Issues this long are hard to read or contribute to, and tend to take very long to reach a conclusion. Instead, why not:
Is this issue intended to be sprawling? Consider adding label |
TODO
|
switched to 100% of cloud users |
Is your feature request related to a problem?
While unix timestamps work, they're not very approachable for most users. This requires users to manually convert timestamps outside of PostHog or to use a plugin to convert this for them.
Describe the solution you'd like
The ability to filter in a format that's most approachable to the user composing the filter. Unix timestamps might be best for some users, but other users might prefer UTC or their local time.
Describe alternatives you've considered
The alternative is leaving this as it is.
Additional context
Reported by a user via our community slack today.
Thank you for your feature request – we love each and every one!
The text was updated successfully, but these errors were encountered: