Bufdir Period Selector Widget
Component Detail
Description
Reusable date-range picker pre-configured for common Bufdir reporting periods (quarter, half-year, full year). Validates that the selected range covers at least one complete reporting period.
bufdir-period-selector-widget
Summaries
The Bufdir Period Selector Widget removes a common source of reporting errors by guiding administrators toward valid Bufdir reporting periods — quarters, half-years, and full years — rather than allowing arbitrary date ranges that Bufdir's submission system may reject. By pre-configuring the most common reporting windows as selectable presets, the component dramatically reduces the time administrators spend navigating calendar pickers and mentally calculating period boundaries. This translates directly into fewer failed submissions, less time spent correcting and resubmitting reports, and reduced support load for the programme team. As a shared, reusable widget, any future reporting screen that requires Bufdir-compliant period selection can adopt it immediately, ensuring consistent validation logic and a uniform user experience across the platform without duplicated development effort.
This is a low-complexity shared widget with no external dependencies, making it a strong candidate for early development to unblock both the Bufdir export screen and any other reporting flows that require period selection. The key delivery risk is alignment with Bufdir's actual reporting period definitions — specifically which preset windows are recognised and what boundary rules apply — which must be confirmed with the programme team or Bufdir documentation before implementation begins to avoid rework. Testing should cover preset selection, custom range entry, boundary validation (minimum one complete period), and edge cases around year-end boundaries. Because it is shared, any change after initial delivery has a wider blast radius, so the API surface should be finalised carefully before downstream screens depend on it.
Estimate half a sprint for implementation and testing.
BufdirPeriodSelectorWidget is a shared, stateful frontend/mobile widget with no upstream dependencies. It exposes setPreset(ReportingPeriod preset) to programmatically apply a named period (QUARTER, HALF_YEAR, FULL_YEAR) mapped to absolute DateRange values computed relative to the current date or a provided reference date. The underlying date-range picker renders month/year controls constrained to the preset boundaries when a preset is active, or free-form selection when custom mode is engaged. validatePeriod(DateRange range) enforces that the selected range spans at least one complete Bufdir reporting interval, returning a typed validation result with a localised error message on failure.
onPeriodSelected(DateRange period) is a callback prop injected by the parent screen, fired only after validation passes. getSelectedPeriod() provides synchronous read access for parent components that need to read current selection on demand rather than via callback. resetToDefault() clears selection back to the current quarter preset. Ensure all date arithmetic is timezone-aware and uses the Norwegian locale for display formatting.
Responsibilities
- Render preset period shortcuts and custom date-range picker
- Validate period boundaries against Bufdir requirements
- Emit selected period to parent screen
Interfaces
onPeriodSelected(DateRange period)
setPreset(ReportingPeriod preset)
getSelectedPeriod()
validatePeriod(DateRange range)
resetToDefault()