@archon-js/plugin-range
v0.1.0
Published
Range selection plugin for Archon
Downloads
19
Readme
@archon-js/plugin-range
Range date selection plugin for Archon. Reference implementation of a SelectionStrategy plugin.
Install
pnpm add @archon-js/plugin-range @archon-js/coreUsage
import { createCalendarEngine } from '@archon-js/core';
import { createNativeDateAdapter } from '@archon-js/adapter-native';
import { rangePlugin } from '@archon-js/plugin-range';
const engine = createCalendarEngine({
adapter: createNativeDateAdapter(),
plugins: [rangePlugin()],
closeOnSelect: true,
});The plugin calls setSelectionStrategy(rangeSelectionStrategy()) and setRangeMode(true) during initialize, so input parsing and formatting treat values as ranges automatically.
RangeSelectionStrategy
| Click | Behavior |
| --- | --- |
| First | Sets range start, end: null — incomplete |
| Second (after start) | Sets end — complete: true, shouldClose: true |
| Second (before start) | Restarts with clicked date as new start |
| After complete range | Restarts a new partial range |
Export rangeSelectionStrategy() directly if you need the strategy without the plugin wrapper.
