useRuleBetweenOperator()
WARNING
Single File Component (SFC) support for Administration extensions is experimental. It is available since Shopware 6.7.16.0. The APIs described on this page can still change without a deprecation. Try it out and tell us what you find, but do not ship an extension built on it to customers or to the Shopware Store until the API is declared stable (planned for 6.9).
ts
import { useRuleBetweenOperator } from 'shopware:composables';
function useRuleBetweenOperator(options: {
condition: () => RuleCondition | null | undefined;
ensureValueExist: () => void;
}): {
isBetween: ComputedRef<boolean>;
betweenValue: WritableComputedRef<{ from: string | null; to: string | null }>;
};Renders a condition's between operator as a from/to pair on a date or datetime field.
ts
const { isBetween, betweenValue } = useRuleBetweenOperator({
condition: () => props.condition,
ensureValueExist: () => emit('ensure-value-exist'),
});betweenValue is writable, and writing calls ensureValueExist() first, the way the mixin reached into its host to do. A condition whose renderedFieldValue is not an object reads as { from: null, to: null } rather than throwing.
Replaces the rule-between-operator mixin.