Skip to content

Statistic: concrete date range selector (Today/Week/Month/All/Custom)#46

Open
IanTheMitten wants to merge 1 commit into
mainfrom
codex/update-daterangeselector-for-new-options
Open

Statistic: concrete date range selector (Today/Week/Month/All/Custom)#46
IanTheMitten wants to merge 1 commit into
mainfrom
codex/update-daterangeselector-for-new-options

Conversation

@IanTheMitten

Copy link
Copy Markdown
Owner

Motivation

  • Replace sampled/seeded date selection and chosen-month behavior with explicit date windows so analytics receive concrete start/end boundaries.
  • Provide a Custom mode with simple validation so users can pick an exact inclusive date interval used by downstream charts.

Description

  • Reworked DateRangeSelector to support Today, This Week, This Month, All Time, and Custom, and to emit resolved windows via onRangeResolvedChange as { dateRange, startDate?, endDate? }.
  • Added start/end date inputs for Custom with parsing and validation that enforces start <= end and shows an inline error when invalid.
  • Updated StatisticPage to consume the selector output as a single StatisticSamplingOptions state (dateRange plus optional startDate/endDate) and removed the old chosen-month / seed props.
  • Simplified analyticsSampling logic to remove seeded/random sampling and to filter eligible weekday dates by optional startDate/endDate instead of sampling modes.

Testing

  • Ran npm run build and the production build completed successfully.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2cd62afb0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +80 to +82
selected: eligibleDates
.filter((date) => isWithinRange(date, options))
.sort((a, b) => a.getTime() - b.getTime()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor preset dateRange when bounds are absent

getSampledTransactionDates now filters only by startDate/endDate, so any caller that provides only dateRange (for example the initial StatisticPage state { dateRange: 'thisMonth' }) gets all historical weekdays instead of the selected preset window until another update supplies concrete bounds. This produces incorrect chart/table values on initial render and can trigger unnecessary full-history aggregation work.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant