Giter Club home page Giter Club logo

react-time-range-picker's Introduction

react-time-range-picker

A simple HTML5 canvas time range picker in React.

Installation

npm i react-time-range-picker

Demo

alt text alt text

Usage

import TimeRangePicker from 'react-time-range-picker'; <TimeRangePicker hourmarkers hourlines/>

Example


import React, { Component } from 'react';
import TimeRangePicker from 'react-time-range-picker';

export default class App extends Component {

  pickerupdate = (start_time, end_time) => {
    // start and end time in 24hour time
    console.log(`start time: ${start_time}, end time: ${end_time}`)
  }

  render() {
    return (
      <div>
	      <TimeRangePicker hourmarkers hourlines timeupdate={this.pickerupdate}/>
      </div>
    );
  }
}

Props

hourmarkers - enables vertically numbered list of 12hour format markers.

hourlines - enables horizontal hour lines.

rangecolor - css color string to set range color.

markercolor - css color string to set vertical markers

markerfont - defaults to css string "15px Arial".

timeupdate - function which is called on mouseup with start_time and end_time respectively in 12 hour time format.

snapto - defaulto to 50, that is, 50% of the hour. set to 1 for highest granuality, i.e snapto={1}.

react-time-range-picker's People

Contributors

alexandercollins avatar alexanderdesmond avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zengzimo

react-time-range-picker's Issues

'From {start} to {end}' display overflows into below divs

image

I believe this is cause by the fact that the canvas div is set to be 100% of the containing div leaving no space for the h3. A fix might be to have the canvas height and width be set to 500px (As you already have for the outer div) and change the height of the outer div to auto

Noon (12pm) is displayed at 12am

Thanks for making this! I just noticed that in this component the 12am and 12pm times are reversed (for western times, at least, 12pm is noon and 12am is midnight).

screen shot 2018-07-03 at 9 05 37 pm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.