1.3.10 • Published 2 years ago

react-month-picker-input v1.3.10

Weekly downloads
633
License
MIT
Repository
github
Last release
2 years ago

React-Month-Picker-Input

A month picker input and calendar for React.

Demo

Live demo: optimify-studio.github.io/react-month-picker-input

API

NameTypesDefaultDescription
modeenum'normal'Component mode. Available are 'normal', 'readOnly' (input cannot be changed, calendar can be opened but selection is disabled), 'calendarOnly' (input cannot be changed and date can be selected only though calendar)
yearnumbervoidPreselect year in calendar
monthnumber (0..11)voidPreselect month in calendar. If both year and month are specified then input field will be also prepopulated
inputPropsobjectempty objectInput field props, the following attrs are supported: id, name, className, size, maxLength, required.
onChangeFunction: (maskedValue: string, year: number, month: number) => any-onChange callback, receives maskedValue, year and month (begins with 0) as arguments
closeOnSelectbooleanfalseClose calendar on month select
langstringenOne of: en, ja, es, fr, ru, ua, hu
i18ni18n object (optional)see i18n schema belowi18n object. For now date formats must be either MM/YY or YY/MM
minDate, maxDatenumber, number0, 1, 11, 9999Limit selection with minDate or maxDate constraints

I18n config

NameTypesDefaultDescription
monthFormatstring'short'One of: short, long. Display short or long format of month name (E.g. Jan or January)
dateFormat{ lang: string }see src/i18n.jsObject where langs are keys and values can either be YY/MM or MM/YY
monthNames{ lang: string[] }see src/i18n.jsObject where langs are keys and values are arrays of month names

Installation

npm install react-month-picker-input --save

Usage

React-Month-Picker-Input generates an input field and year/month calendar opened on field focus.

var MonthPickerInput = require('react-month-picker-input');
require('react-month-picker-input/dist/react-month-picker-input.css');

<MonthPickerInput
  year={2018}
  month={8}
  onChange={function(maskedValue, selectedYear, selectedMonth) {
    console.log(maskedValue, selectedYear, selectedMonth);
  }}
/>

License

Copyright (c) 2017 Viacheslav Kysil. MIT License.

1.3.10

2 years ago

1.3.9

2 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

5 years ago

1.2.11

5 years ago

1.2.10

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.0.0

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago