feat(runtime): per-page default Period via daterange "default" - #37
Merged
Conversation
Add an optional `default` to the `daterange` page filter — one of today / last-7-days / last-30-days / last-90-days / this-month / last-month. When the URL sets no range, the page opens on this period, resolved live against today (so it never goes stale); an explicit ?from=&to= still wins, and omitting it keeps the all-time behavior. Preset math is hoisted from PageFilters into the shared client/pageFilters module (PERIOD_PRESETS, presetBounds, defaultRangeBounds) so the route and the control build ranges from one source; the control's UI is unchanged. Finance "holdings" page dogfoods last-90-days.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Page-level
daterangefilters can now declare adefaultperiod. Until now every page opened on All time with no way to set a per-page default.A
daterangefilter gains an optionaldefault:{ "id": "period", "type": "daterange", "label": "Period", "bind": { "transactions": "ts" }, "default": "last-90-days" }One of
today,last-7-days,last-30-days,last-90-days,this-month,last-month— the same set already offered by the date-range control's presets.Behavior
default, resolved live against today so it never goes stale (last-90-daysalways means the last 90 days from now).?from=&to=still wins — the default only fills the gap.defaultkeeps the current all-time behavior.How
Preset math is hoisted out of
PageFiltersinto the sharedruntime/src/client/pageFilters.ts(PERIOD_PRESETS,presetBounds,defaultRangeBounds) so the route and the control build ranges from one source — the control's UI is unchanged. The route resolves the default inPageViewwhenfrom/toare absent;validateSearch(and the URL shape) is untouched.The keystone schema change in
@openislands/schemaregenerates types + JSON Schema; CLI/runtime/MCP follow.Dogfood
Finance template
holdingspage defaults tolast-90-days(daily transaction data).Verified
pnpm build,pnpm typecheck,pnpm test(389/389),pnpm lint,pnpm validate:templates— all green.presetBounds+defaultRangeBounds.holdings→Mar 28 – Jun 25, 2026;overview(no default) →All time;holdings?from=2026-01-01&to=2026-01-31→Jan 1 – Jan 31, 2026.Docs
Updated
docs/data-app-model.md,apps/docs/.../reference/manifest.mdx, andconcepts/manifest.mdx.