Rich scheduling/rules editor powered by @karmaniverous/rrstack
. Use it to define activation windows (spans) and recurring schedules with fine-grained constraints.
Value type: RRStackOptions
(timezone, timeUnit, rules).
Peer dependency: @karmaniverous/rrstack
(install in your app when using this component).
Options
endDatesInclusive?: boolean
(default: false
) — when true
, an End Date entered without a time is treated as inclusive in the rule’s timezone (clamped to midnight of the next day). This matches common reporting expectations for “through end of day”.import { useForm } from 'react-hook-form';
import { Form } from 'semantic-ui-react';
import { HookFormRRStack } from '@karmaniverous/hook-form-semantic';
type FormData = {
schedule: {
timezone: string;
timeUnit?: 'ms' | 's';
rules: unknown[];
};
};
export function ScheduleEditor() {
const { control, handleSubmit } = useForm<FormData>({
defaultValues: {
schedule: {
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
timeUnit: 'ms',
rules: [],
},
},
});
return (
<Form onSubmit={handleSubmit(console.log)}>
<HookFormRRStack<FormData>
hookControl={control}
hookName="schedule"
label="Availability"
/>
<Form.Button primary style={{ marginTop: 12 }}>
Save
</Form.Button>
</Form>
);
}
Notes
@karmaniverous/rrstack
as a peer dependency.