1.0.2 • Published 1 month ago

react-weblineindia-date-picker v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
1 month ago

ReactJS - Custom Datepicker

ReactJS based Custom Datepicker component to select date.

Table of contents

Browser Support

ChromeFirefoxSafariEdgeIE
83.0 ✔77.0 ✔13.1.1 ✔83.0 ✔11.9 ✔

Demo

npm.io


npm.io

Getting started

Install the npm package:

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

Usage

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

import React ,{ Component } from 'react';
import Calendar from 'react-weblineindia-date-picker'

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

  render() {
    return (
      <div>
        <Calendar id="basic" value={this.state.date1} onChange={(e) => this.setState({ date1: e.value })} />
      </div>
    );
  }
}

export default Test;

Available Props

PropTypedefaultDescription
valueanynullValue of the component.
selectionModestringsingleDefines the quantity of the selection, valid values are "single", "multiple" and "range".
placeholderString'Date picker'Placeholder text for the date picker
localestringenLocalization for different languages and formats is defined by binding the locale.
dateFormatstringmm/dd/yyEFormat of the date.
showIconbooleanfalseWhen enabled, displays a button with icon next to input.
iconstringpi pi-calendarIcon of the calendar button.
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.
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.
touchUIbooleanfalseWhen enabled, calendar overlay is displayed as optimized for touch devices.
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.
isDarkThemebooleanfalseChange theme of the date picker.

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.

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-date-picker is inspired by primereact.

License

MIT

Keywords

react-weblineindia-datepicker, react-datepicker, reactjs-datepicker, react-calendar, date-picker, datepicker, react-datetime, datetime-picker