Skip to content

feat(analysis): add relative date filters for Analysis Mode (#566)#657

Closed
cct08311github wants to merge 0 commit intodotnet8from
feat/analysis-relative-date-filters-566
Closed

feat(analysis): add relative date filters for Analysis Mode (#566)#657
cct08311github wants to merge 0 commit intodotnet8from
feat/analysis-relative-date-filters-566

Conversation

@cct08311github
Copy link
Copy Markdown
Owner

Summary

  • Frontend: createValueInput() for date fields now renders a <span> wrapper with a mode <select> (8 relative tokens + "自訂日期") and a hidden .analysis-filter-value input. collectFilters() is unchanged — deep querySelector('.analysis-filter-value') finds the input inside the wrapper.
  • Backend: ResolveRelativeDates() in AnalysisQueryEngine expands @today / @thisWeek / @lastWeek / @thisMonth / @lastMonth / @last30Days / @thisQuarter / @ytd tokens into Gte/Lte FilterCondition pairs before ApplyFilters builds expression trees. Unknown tokens throw InvalidOperationException.
  • i18n: Both zh-TW and en-US locales updated with reldate.* keys.

Supported Tokens

Token Expands to
@today Today 00:00 – 23:59
@thisWeek Monday – Sunday of current ISO week
@lastWeek Monday – Sunday of previous ISO week
@thisMonth 1st – last day of current month
@lastMonth 1st – last day of previous month
@last30Days -30 days to today
@thisQuarter 1st day of current quarter to today
@ytd Jan 1 of current year to today

Test plan

  • 8 MSTest for ResolveRelativeDates (no-op, @today, @last30Days, @ytd, mixed, unknown token throws, @thisWeek Monday, @thisMonth bounds)
  • 9 Jest for date mode UI (createValueInput span shape, 9 options, token → hidden input, custom → visible input, collectFilters reads token)
  • Updated existing #501 test to match new span-wrapper shape for date fields
  • All 529 Jest tests pass; all C# engine tests pass

Closes #566

🤖 Generated with Claude Code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enhancement(analysis): 缺乏相對日期篩選與查詢儲存功能,BA 每次重建查詢

1 participant