How to use the flatpickr/dist/plugins/rangePlugin function in flatpickr

To help you get started, we’ve selected a few flatpickr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github carbon-design-system / carbon-components-react / src / components / DatePicker / DatePicker.js View on Github external
let appendToNode;

      // inputField ref might not be set in enzyme tests
      if (this.inputField) {
        this.cal = new flatpickr(this.inputField, {
          defaultDate: value,
          appendTo: appendToNode,
          mode: datePickerType,
          allowInput: true,
          dateFormat: dateFormat,
          locale: l10n[locale],
          minDate: minDate,
          maxDate: maxDate,
          plugins:
            datePickerType === 'range'
              ? [new rangePlugin({ input: this.toInputField })]
              : '',
          clickOpens: true,
          nextArrow: this.rightArrowHTML(),
          prevArrow: this.leftArrowHTML(),
          onChange: (...args) => {
            if (onChange) {
              onChange(...args);
            }
          },
          onReady: onHook,
          onMonthChange: onHook,
          onYearChange: onHook,
          onOpen: onHook,
          onValueUpdate: onHook,
        });
        this.addKeyboardEvents(this.cal);
github IBM / carbon-components-angular / src / datepicker / datepicker.component.ts View on Github external
get flatpickrOptions() {
		const plugins = [...this.plugins, carbonFlatpickrMonthSelectPlugin];
		if (this.range) {
			plugins.push(rangePlugin({ input: `#${this.id}-rangeInput`, position: "left"}));
		}
		return Object.assign({}, this._flatpickrOptions, this.flatpickrBaseOptions, {
			mode: this.range ? "range" : "single",
			plugins,
			dateFormat: this.dateFormat
		});
	}
github orchidsoftware / platform / resources / js / controllers / fields / datetime_controller.js View on Github external
initialize() {
        const plugins = [];
        if (this.data.get('range')) {
            plugins.push(new rangePlugin({ input: this.data.get('range') }));
        }

        this.config = {
            locale: document.documentElement.lang,
            plugins,
        };
    }