How to use the tiny-date-picker function in tiny-date-picker

To help you get started, we’ve selected a few tiny-date-picker 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 sparkdesignsystem / spark-design-system / packages / spark / base / datePicker.js View on Github external
lang: {
      days: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
    },
    min: '01/1/2008',
    max: '01/1/2068',
    format: date =>
      date
        .toLocaleDateString('en-US', {
          month: '2-digit',
          day: '2-digit',
          year: 'numeric',
        })
        .replace(/[^ -~]/g, ''),
  };

  const dp = TinyDatePicker(input, Object.assign(tdpConfig, config));

  dp.on('select', () => {
    let event;

    if (typeof Event === 'function') {
      event = new Event('input');
    } else {
      event = document.createEvent('Event');
      event.initEvent('input', true, true);
    }

    input.dispatchEvent(event);

    input.focus();
  });
};
github sparkdesignsystem / spark-design-system / src / angular / projects / spark-core-angular / src / lib / directives / inputs / sprk-datepicker / sprk-datepicker.directive.ts View on Github external
days: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
      },
      min: '01/1/2008',
      max: '01/1/2068',
      format: date =>
        date
          .toLocaleDateString('en-US', {
            month: '2-digit',
            day: '2-digit',
            year: 'numeric'
          })
          .replace(/[^ -~]/g, '')
    };

    if (TinyDatePicker) {
      TinyDatePicker(input, {
        ...tdpConfig,
        ...this.sprkDatePickerConfig
      }).on('select', () => {
        this.ref.nativeElement.dispatchEvent(new Event('input'));
        this.ref.nativeElement.focus();
      });
    }
  }
}
github sparkdesignsystem / spark-design-system / react / src / base / inputs / SprkDatePickerInput / SprkDatePickerInput.js View on Github external
componentDidMount() {
    const { datePickerConfig } = this.props;
    TinyDatePicker(
      this.datePickerInputRef.current,
      assign(this.tdpConfig, datePickerConfig),
    );
  }
github sparkdesignsystem / spark-design-system / src / angular / projects / spark-angular / src / lib / directives / inputs / sprk-datepicker / sprk-datepicker.directive.ts View on Github external
days: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
      },
      min: '01/1/2008',
      max: '01/1/2068',
      format: date =>
        date
          .toLocaleDateString('en-US', {
            month: '2-digit',
            day: '2-digit',
            year: 'numeric'
          })
          .replace(/[^ -~]/g, '')
    };

    if (TinyDatePicker) {
      TinyDatePicker(input, {
        ...tdpConfig,
        ...this.sprkDatePickerConfig
      }).on('select', () => {
        this.ref.nativeElement.dispatchEvent(new Event('input'));
        this.ref.nativeElement.focus();
      });
    }
  }
}
github kromitgmbh / titra / imports / ui / pages / tracktime.js View on Github external
Template.tracktime.onRendered(() => {
  Template.instance().tinydatepicker = TinyDatePicker('#date', {
    format(date) {
      return date ? moment(date).format('ddd, DD.MM.YYYY') : moment().format('ddd, DD.MM.YYYY')
    },
    parse(date) {
      return moment(date, 'ddd, DD.MM.YYYY')
    },
    mode: 'dp-modal',
    dayOffset: 1,
  }).on('select', (_, dp) => {
    if (!dp.state.selectedDate) {
      $('#date').val(moment().format('ddd, DD.MM.YYYY'))
    }
  })
})
Template.tracktime.onCreated(function tracktimeCreated() {
github sparkdesignsystem / spark-design-system / src / react / projects / spark-core-react / src / SprkInput / SprkDatePickerInput / SprkDatePickerInput.js View on Github external
componentDidMount() {
    const { datePickerConfig } = this.props;
    TinyDatePicker(this.datePickerInputRef.current, assign(this.tdpConfig, datePickerConfig));
  }
github sparkdesignsystem / spark-design-system / angular / projects / spark-angular / src / lib / directives / inputs / sprk-datepicker / sprk-datepicker.directive.ts View on Github external
days: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
      },
      min: '01/1/2008',
      max: '01/1/2068',
      format: date =>
        date
          .toLocaleDateString('en-US', {
            month: '2-digit',
            day: '2-digit',
            year: 'numeric'
          })
          .replace(/[^ -~]/g, '')
    };

    if (TinyDatePicker) {
      TinyDatePicker(input, {
        ...tdpConfig,
        ...this.sprkDatePickerConfig
      }).on('select', () => {

        let event;

        if (typeof(Event) === 'function') {
          event = new Event('input');
        } else {
          event = document.createEvent('Event');
          event.initEvent('input', true, true);
        }

        this.ref.nativeElement.dispatchEvent(event);
        this.ref.nativeElement.focus();
      });

tiny-date-picker

A light-weight date picker with zero dependencies.

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Popular tiny-date-picker functions