GenSpectrum / dashboard-components

https://genspectrum.github.io/dashboard-components/
GNU Affero General Public License v3.0
2 stars 0 forks source link

Remove predefined date range options from DateRangeSelector #473

Closed JonasKellerer closed 2 weeks ago

JonasKellerer commented 1 month ago

When using gs-date-range-selector, it becomes apparent, that the predefined date range options are hindering. One needs to write custom logic in two places. I would suggest removing the predefined options and only have "Custom" left. This way the user has more agency over the component.

fengelniederhammer commented 1 month ago

Maybe we can instead supply constants that make it easy to plug the now predefined date ranges into the component?

export type CustomSelectOption<CustomLabel extends string> = { label: CustomLabel; dateFrom: string; dateTo: string };

export const LAST_6_MONTHS = { label: "last6Months"; dateFrom: today().minus("6 months"); dateTo: today() };
export const LAST_MONTH = ...;
JonasKellerer commented 1 month ago

Sounds like a good idea.