react-time-period-picker

1.0.3 • Public • Published

React time period picker

Simple react component to select multiple time ranges

Getting Started

Package allows to select certain time ranges or periods.

data = {
    {start: "03:06", end: "03:10"},
    {start: "03:11", end: "03:18"},
    ...
}

alt text

alt text

import React, { Component } from 'react'
import Time from 'react-time-period-picker'
import  './react-time-period-picker/dist/time.css'
class App extends Component {

  constructor(props) {
      super(props);
      this.state = {
       
      };
  }
  onOpeningsChange(e) {
    this.setState({openings:e});
}
  render() {
    return (<div>
      <Time
        onChange={this.onOpeningsChange.bind(this)}
        data={this.state.openings}
        />
                            
    </div>)
  }
}
export default App;

Use your on css for better UI

props

Prop Description Default
data List of time ranges (Array of objects with start and end times) Array []
canOverlap Allow to overlap time ranges false
className --- ""
invalidOverlapText Invalid message on Overlap Time cannot be overlaped
equalRangeText invalid message in equal time periods Time cannot be equal

Acknowledgments

*antd *moment

Package Sidebar

Install

npm i react-time-period-picker

Weekly Downloads

2

Version

1.0.3

License

ISC

Unpacked Size

9.67 kB

Total Files

4

Last publish

Collaborators

  • sojin.antony01