1.0.15 • Published 5 years ago

month-picker-input v1.0.15

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

React-Month-Picker-Input

A month picker input and calendar for React.

Demo

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

API

NameTypesDefaultDescription
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, only id and name are supported
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

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
  value={new Date()}
  onChange={function(selectedYear, selectedMonth) {
    console.log(selectedYear, selectedMonth);
  }}
/>

License

Copyright (c) 2017 Viacheslav Kysil. MIT License.

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago