import { KbqTimeRangeModule } from '@koobiq/components/time-range';@Component({ selector: 'kbq-time-range' })
class KbqTimeRange<T> implements ControlValueAccessor {
readonly minDate = input<T>();
readonly maxDate = input<T>();
readonly defaultRangeValue = input<KbqRangeValue<T>>();
readonly availableTimeRangeTypes = input<KbqTimeRangeType[]>(
this.timeRangeService.providedDefaultTimeRangeTypes
);
readonly titleTemplate = input<TemplateRef<KbqTimeRangeCustomizableTitleContext>>();
readonly optionTemplate = input<TemplateRef<KbqTimeRangeOptionContext>>();
readonly arrow = input<boolean>(true);
readonly showRangeAsDefault = input<boolean>(true);
readonly nonNullable = input<boolean>(true);
readonly valueCorrected = output<KbqTimeRangeRange>();
readonly value: Signal<KbqTimeRangeRange | null>;
readonly disabled: Signal<boolean>;
onVisibleChange(isVisible: boolean): void;
}minDateT The earliest date the calendars offer and the validation accepts.
maxDateT The latest date the calendars offer and the validation accepts.
defaultRangeValueKbqRangeValue<T> Seeds the from/to pair of the manual range.
availableTimeRangeTypesKbqTimeRangeType[] The options the editor offers, in order. The first one is selected by default.
titleTemplateTemplateRef<KbqTimeRangeCustomizableTitleContext> Replaces the built-in trigger.
optionTemplateTemplateRef<KbqTimeRangeOptionContext> Replaces the built-in rendering of an option in the editor.
arrowboolean Whether the popover is drawn with an arrow.
showRangeAsDefaultboolean Keeps the manual range visible even when range is not in availableTimeRangeTypes.
nonNullableboolean Falls back to a default value instead of holding null.
localeOverridesKbqPartialLocaleData | undefined Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.
valueCorrectedKbqTimeRangeRange Emits the corrected value when the provided one could not be used as is.
valueSignal<KbqTimeRangeRange | null> The applied time range, or null when the component is nullable and holds no value.
This is what the trigger renders, so it lags the editor until Apply.
disabledSignal<boolean> Whether the control is disabled through the forms layer.
Component simulates KbqFormFieldControl allowing to provide custom content inside KbqFormField
@Component({ selector: 'kbq-time-range-title-as-control' })
class KbqTimeRangeTitleAsControl implements KbqFormFieldControl<KbqTimeRangeRange> {}Directive for easy using styles of time-range placeholder publicly.
@Directive({ selector: '[kbqTimeRangeTitlePlaceholder]' })
class KbqTimeRangeTitlePlaceholder {}type KbqCustomTimeRangeType = {
type: KbqTimeRangeType | string;
units: KbqTimeRangeUnits;
translationType: KbqTimeRangeTranslationType;
range?: KbqRange;
};typeKbqTimeRangeType | string time range identifier. Used as config key
unitsKbqTimeRangeUnits Duration metadata
translationTypeKbqTimeRangeTranslationType Property representing duration output unit
rangeKbqRange Custom range of start/end date-times
Represents a time range with optional start and end date-time values. Used as a range value by default.
type KbqRange = {
startDateTime?: string;
endDateTime?: string;
};Represents a time range with optional start and end date-time values. Used as a form value when range in popover change.
interface KbqRangeValue<T> {
fromTime?: T;
fromDate?: T;
toTime?: T;
toDate?: T;
}Context for a time range trigger customization, combining meta information.
type KbqTimeRangeCustomizableTitleContext = Partial<KbqTimeRangeTitleContext> & {
$implicit: Partial<KbqTimeRangeTitleContext> & { formattedDate: string; popover: KbqPopoverTrigger };
} & { formattedDate: string; popover: KbqPopoverTrigger };Context for a time range option customization, combining meta information.
type KbqTimeRangeOptionContext = KbqTimeRangeTypeContext & KbqTimeRangeUnits & {
translationType: KbqTimeRangeTranslationType;
formattedValue: string;
};Main range information. Used for a popover date range selection, when selected type is range, and for trigger information calculation.
type KbqTimeRangeRange = KbqRange & KbqTimeRangeTypeContext;Context for a time range trigger, combining range info and type.
type KbqTimeRangeTitleContext = KbqTimeRangeRange & KbqTimeRangeUnits;Property representing duration output unit
type KbqTimeRangeTranslationType = Exclude<DurationUnit, 'quarters' | 'milliseconds'> | 'other';Default accepted “time‑range” identifiers.
type KbqTimeRangeType = | 'lastMinute'
| 'last5Minutes'
| 'last15Minutes'
| 'last30Minutes'
| 'lastHour'
| 'last24Hours'
| 'last3Days'
| 'last7Days'
| 'last14Days'
| 'last30Days'
| 'last3Months'
| 'last12Months'
| 'allTime'
| 'currentQuarter'
| 'currentYear'
| 'range';Range type selected
type KbqTimeRangeTypeContext = {
type: KbqTimeRangeType;
};Configuration for a custom time range with duration metadata. Defines a time range with its identifier, duration units, and optional fixed date range.
interface KbqTimeRangeUnits extends DurationObjectUnits {
years?: number;
quarters?: number;
months?: number;
weeks?: number;
days?: number;
hours?: number;
minutes?: number;
seconds?: number;
milliseconds?: number;
}Time range types in range editor if nothing provided
const defaultTimeRangeTypes: KbqTimeRangeType[];Preset of custom time ranges, provided by DI.
const KBQ_CUSTOM_TIME_RANGE_TYPES: InjectionToken<KbqCustomTimeRangeType[]>;Preset of selectable time ranges, provided by DI.
const KBQ_DEFAULT_TIME_RANGE_TYPES: InjectionToken<KbqTimeRangeType[]>;Localization configuration provider.
const KBQ_TIME_RANGE_LOCALE_CONFIGURATION: InjectionToken<KbqTimeRangeLocaleConfiguration>;Utility provider for KBQ_TIME_RANGE_LOCALE_CONFIGURATION. Only the strings you pass are overridden;
the rest keep following the active locale.
const kbqTimeRangeLocaleConfigurationProvider: (
configuration: KbqDeepPartial<KbqTimeRangeLocaleConfiguration>
) => Provider;Validates that the 'from' date-time is not greater than the 'to' date-time in a range form. Returns an error if the start date-time occurs after the end date-time.
const rangeValidator: <T>(
timeRangeService: KbqTimeRangeService<T>
) => ValidatorFn;