1.1.28 • Published 4 years ago

react-tix-date-time-picker v1.1.28

Weekly downloads
3
License
MIT
Repository
-
Last release
4 years ago

React-Tix-Date-Time-Picker v1.1.16

A date time picker for your React app.

  • Pick days, months, years, and time
  • Supports english and indonesian
  • No moment.js needed
  • Build on top of react-day-picker plugin

Install

Install by executing

npm install --save react-tix-date-time-picker --registry=http://verdaccio.tiket.com:8080

Date Picker

Usage

Displays an input field complete with inputs and a calendar. Here's an example of basic usage:

import React, { Component } from 'react';
import { DatePicker } from 'react-tix-date-time-picker';
import 'react-tix-date-time-picker/libs/styles.css';

class MyApp extends Component {
  onApply = date => this.setState({ date })

  render() {
    return (
      <div>
        <DatePicker
          onApply={this.onApply}
        />
      </div>
    );
  }
}

Props

Prop nameDescriptionExample values
classNameDefines datepicker container class name(s).String: "class1 class2"
inputClassNameDefines datepicker input class name(s).String: "class1 class2"
placeholderDefines input placeholder.String: "Choose Date"
dateFormatDefines the date format content of the inputString: "yyyy-mm-dd HH:MM:ss"
valueDefines initial or value of date inputString: "2018-03-01"Date Object new Date()
langDefines the content language.String: "en"
onApplyFunction called when the user clicks a date or click apply button on calendar.(selectedDate) => alert('Sellected date is: ', selectedDate)
selectTypeDefine type of date selection, enum of: "single", "multiple" or "range"String: "multiple"
beforeShowFunction called before calendar shown.(dateValue, input, overlay) => { console.log(dateValue) }
afterShowFunction called after calendar shown.(dateValue, input, overlay) => { console.log(dateValue) }
beforeHideFunction called before calendar hide.(dateValue, input, overlay) => { console.log(dateValue) }
afterHideFunction called after calendar hide.(dateValue, input, overlay) => { console.log(dateValue) }

rest of available props relies on react-day-picker documentation

Function

.reset() Function to reset datepicker state. usage:

<DatePicker ref={dp => this.datePicker = dp}>

...

handleClick() {
  this.datepicker.reset();
}

Date Time Picker

Usage

Displays an input field complete with inputs, a calendar and time picker. Here's an example of basic usage:

import React, { Component } from 'react';
import { DateTimePicker } from 'react-tix-date-time-picker';
import 'react-tix-date-time-picker/libs/styles.css';

class MyApp extends Component {
  onApply = date => this.setState({ date })

  render() {
    return (
      <div>
        <DateTimePicker
          onApply={this.onApply}
        />
      </div>
    );
  }
}

Props

Prop nameDescriptionExample values
classNameDefines date time picker class name(s).String: "class1 class2"
inputClassNameDefines input class name(s).String: "class1 class2"
placeholderDefines input placeholder.String: "Choose Date Time"
dateFormatDefines the date format content of the inputString: "yyyy-mm-dd HH:MM:ss"
valueDefines initial or value of date inputString: "2018-03-01"Date Object new Date()
langDefines the content language.String: "en"
onApplyFunction called when the user clicks apply button on calendar.(selectedDate) => alert('Selected date is: ', selectedDate)
minStepDefines the minute increment step.Int: 5
minStartDefines the minimum minute.Int: 10
minEndDefines the maximum minute.Int: 35
hourStepDefines the minute increment step.Int: 2
hourStartDefines the minimum hour.Int: 6
hourEndDefines the maximum hour.Int: 22

rest of available props relies on react-day-picker documentation

Time Picker

Usage

Displays an input field complete with inputs and time picker. Here's an example of basic usage:

import React, { Component } from 'react';
import { TimePicker } from 'react-tix-date-time-picker';
import 'react-tix-date-time-picker/libs/styles.css';

class MyApp extends Component {
  onApply = time=> this.setState({ time })

  render() {
    return (
      <div>
        <TimePicker 
          onApply={this.onApply}
        />
      </div>
    );
  }
}

Props

Prop nameDescriptionExample values
classNameDefines date time picker class name(s).String: "class1 class2"
inputClassNameDefines input class name(s).String: "class1 class2"
placeholderDefines input placeholder.String: "Select Time"
timeFormatDefines the time format content of the inputString: "HH:MM"
valueDefines initial or value of time inputString: "20:10"Date Object: new Date()
langDefines the content language.String: "en"
onApplyFunction called when the user clicks apply button on time picker.(selectedTime) => alert('Sellected time is: ', selectedTime)
minStepDefines the minute increment step.Int: 5
minStartDefines the minimum minute.Int: 10
minEndDefines the maximum minute.Int: 35
hourStepDefines the minute increment step.Int: 2
hourStartDefines the minimum hour.Int: 6
hourEndDefines the maximum hour.Int: 22

Author

Deni Setyawan.