1.0.3 • Published 3 days ago

react-weblineindia-time-picker v1.0.3

Weekly downloads
64
License
MIT
Repository
github
Last release
3 days ago

ReactJS - TimePicker

A ReactJS based TimePicker component to implement time or datetime selection.

Table of contents

Browser Support

ChromeFirefoxSafariEdgeIE
83.0 ✔77.0 ✔13.1.1 ✔83.0 ✔11.9 ✔

Demo

npm.io npm.io npm.io

Getting started

Install the npm package:

npm install react-weblineindia-time-picker 
# OR 
yarn add react-weblineindia-time-picker

Usage

Use the <react-weblineindia-time-picker> component:

import React ,{ Component } from 'react';
import TimePicker from 'react-weblineindia-time-picker'

class Test extends Component {
  constructor(props) {
    super(props);
    this.state = {
      date: null 
    };
  }

  render() {
    return (
      <div>
        <Calendar
          id="time24" value={this.state.date} onChange={(e) => this.setState({ date: e.value })} showTime showSeconds
        />
      </div>
    );
  }
}

export default Test;

Available Props

PropTypedefaultDescription
valueanynullValue of the component.
localestringenLocalization for different languages and formats is defined by binding the locale.
dateFormatstringmm/dd/yyEFormat of the date.
monthNavigatorbooleanfalseWhether the month should be rendered as a dropdown instead of text.
yearNavigatorbooleanfalseWhether the year should be rendered as a dropdown instead of text.
minDateDatenullThe minimum selectable date.
maxDateDatenullThe maximum selectable date.
disabledDatesarraynullArray with dates to disable.
disabledDaysarraynullArray with disabled weekday numbers.
showTimebooleantrueWhether to display timepicker.
timeOnlybooleanfalseWhether to display timepicker only.
hourFormatString12Specifies 12 or 24 hour format.
stepHourNumber1Hours to change per step.
stepMinuteNumber1Minutes to change per step.
stepSecondNumber1Seconds to change per step.
showSecondsbooleanfalseWhether to show the seconds in time picker.
timeSeparatorstring:Separator of time selector.
inlinebooleanfalseWhen enabled, displays the calendar as inline instead of an overlay.
showOtherMonthsbooleanfalseWhether to display dates in other months (non-selectable) at the start or end of the current month. To make these days selectable use the selectOtherMonths option.
selectOtherMonthsbooleanArray with disabled weekday numbers.Whether days in other months shown before or after the current month are selectable. This only applies if the showOtherMonths option is set to true.
numberOfMonthsnumber1Number of months to display.
viewstringdateType of view to display, valid valids are "date" for datepicker and "month" for month picker.
yearRangestring1960:2050The range of years displayed in the year drop-down in (nnnn:nnnn) format such as (2000:2020).
panelClassstringnullStyle class of the datetimepicker panel.
panelStylestringnullInline style of the datetimepicker panel.
maxDateCountnumbernullMaximum number of selectable dates in multiple mode.
showOnFocusbooleantrueWhen disabled, datepicker will not be visible with input focus.
autoZIndexbooleantrueWhether to automatically manage layering.
baseZIndexnumber0Base zIndex value to use in layering.
showButtonBarbooleanfalseWhether to display today and clear buttons at the footer
shortYearCutoffstring+10The cutoff year for determining the century for a date.
hideOnDateTimeSelectbooleanfalseWhether to hide the overlay on date selection when showTime is enabled.
showWeekbooleanfalseWhen enabled, calendar will show week numbers.
manualInputbooleanfalseWheter to allow prevents entering the date manually via typing.
ariaLabelledBystringnullEstablishes relationships between the component and label(s) where its value should be one or more element IDs.
appendTostringnullId of the element or "body" for document where the overlay should be appended to.
isDarkThemebooleanfalsedark theme for calendar

Methods

NameParametersDescription
date-selectvalue: Selected valueCallback to invoke when a date is selected.
show-Callback to invoke when datepicker panel is shown.
hide-Callback to invoke when datepicker panel is hidden.
today-clickdate: Today as a date instanceCallback to invoke when today button is clicked.
clear-clickevent: Click eventCallback to invoke when clear button is clicked.
month-changeevent.month: New month event.year: New yearCallback to invoke when a month is changed using the navigators.
year-changeevent.month: New month event.year: New yearCallback to invoke when a year is changed using the navigators.

Styling

Following is the list of structural style classes.

NameElement
p-calendarMain container element.
p-calendar-w-btnMain container element when button is enabled.
p-calendar-timeonlyMain container element in time picker only mode.
p-inputtextInput element.
p-datepickerDatepicker element.
p-datepicker-inlineDatepicker element in inline mode
p-monthpickerDatepicker element in month view.
p-monthpicker-monthMonth cell in month view mode.
p-datepicker-touch-uiDatepicker element in touch ui mode.
p-datepicker-calendarTable containing dates of a month.
p-datepicker-current-dayCell of selected date.
p-datepicker-todayCell of today's date.

Want to Contribute?

  • Created something awesome, made this code better, added some functionality, or whatever (this is the hardest part).
  • Fork it.
  • Create new branch to contribute your changes.
  • Commit all your changes to your branch.
  • Submit a pull request.

Collection of Components

We have built many other components and free resources for software development in various programming languages. Kindly click here to view our Free Resources for Software Development.


Changelog

Detailed changes for each release are documented in CHANGELOG.md.

Credits

react-weblineindia-time-picker is inspired by primereact.

License

MIT

Keywords

react-weblineindia-time-picker, react-calendar, react-time-picker, timepicker, reactjs-timepicker, datetimepicker, date-time-picker