evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
3.38k stars 164 forks source link

feat: configurable DateRange presets #1924

Closed AyushAgrawal-A2 closed 2 hours ago

AyushAgrawal-A2 commented 2 weeks ago

Description

closes #1855 closes #1909

Changes:

Checklist

changeset-bot[bot] commented 2 weeks ago

🦋 Changeset detected

Latest commit: 3cd1ad3d4679fe71977f5d6ac15067a5f982e1dc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages | Name | Type | | ----------------------------- | ----- | | @evidence-dev/core-components | Minor | | my-evidence-project | Minor | | @evidence-dev/components | Minor | | @evidence-dev/evidence | Major | | evidence-test-environment | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

netlify[bot] commented 2 weeks ago

Deploy Preview for next-docs-evidence ready!

Name Link
Latest commit 3cd1ad3d4679fe71977f5d6ac15067a5f982e1dc
Latest deploy log https://app.netlify.com/sites/next-docs-evidence/deploys/662450732f47fd000854bdfe
Deploy Preview https://deploy-preview-1924--next-docs-evidence.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 2 weeks ago

Deploy Preview for evidence-development-workspace ready!

Name Link
Latest commit 3cd1ad3d4679fe71977f5d6ac15067a5f982e1dc
Latest deploy log https://app.netlify.com/sites/evidence-development-workspace/deploys/66245073d955160008ef0ec3
Deploy Preview https://deploy-preview-1924--evidence-development-workspace.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

mcrascal commented 2 hours ago

Hey @AyushAgrawal-A2 thanks for this, after looking at some of the other requests coming in around the date picker, my preference is to do something string based, rather than exposing the underlying date functions themselves.

I think with a large list of presets, the option to exclude presets, the option to set a default, and potentially options for start and end dates we'll be able to cover most cases, and keep the API consistent with the mostly string based options we have in other components.

E.g. excludes={['7 Days', '14 Days']}, default='Year to Date'

I'm going to close this for now.

AyushAgrawal-A2 commented 2 hours ago

@mcrascal I realised without discussion, I will not achieve the best implementation which is in line with the product. I may have made similar mistakes in other PRs as well, sorry for wasting your time and thanks for reviewing my PRs.