Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-month-picker-input

optimify-studio4.2kMIT1.3.10

Simple month picker with calendar and input field with mask.

react, month picker

readme

React-Month-Picker-Input

A month picker input and calendar for React.

Demo

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

API

Name Types Default Description
mode enum '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)
year number void Preselect year in calendar
month number (0..11) void Preselect month in calendar. If both year and month are specified then input field will be also prepopulated
inputProps object empty object Input field props, the following attrs are supported: id, name, className, size, maxLength, required.
onChange Function: (maskedValue: string, year: number, month: number) => any - onChange callback, receives maskedValue, year and month (begins with 0) as arguments
closeOnSelect boolean false Close calendar on month select
lang string en One of: en, ja, es, fr, ru, ua, hu
i18n i18n object (optional) see i18n schema below i18n object. For now date formats must be either MM/YY or YY/MM
minDate, maxDate [number, number] [0, 1], [11, 9999] Limit selection with minDate or maxDate constraints

I18n config

Name Types Default Description
monthFormat string 'short' One of: short, long. Display short or long format of month name (E.g. Jan or January)
dateFormat { lang: string } see src/i18n.js Object where langs are keys and values can either be YY/MM or MM/YY
monthNames { lang: string[] } see src/i18n.js Object 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.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.3.10 (2022-06-30)

  • Fix links to demo page and package repository

1.3.9 (2022-06-24)

  • Bump react and react-dom to 16.14.0
  • Bump typescript to 2.9.2
  • Other dependabot updates, see full list here

1.3.8 (2020-06-08)

1.3.7 (2020-04-06)

1.3.6 (2020-04-06)

1.3.5 (2020-04-06)

1.3.4 (2020-01-15)

1.3.3 (2020-01-10)

1.3.2 (2019-12-25)

1.3.1 (2019-12-25)

1.3.0 (2019-10-08)

  • Added support for minDate and maxDate #12

1.2.11 (2019-10-03)

1.2.10 (2019-10-03)

1.2.9 (2019-10-02)

  • chore(deps): bump forwarded from 0.1.1 to 0.1.2 dependencies
  • chore(deps-dev): bump webpack-dev-server from 2.7.1 to 3.1.11 dependencies
  • chore(deps): bump handlebars from 4.0.10 to 4.4.0 dependencies
  • chore(deps): bump lodash.template from 4.4.0 to 4.5.0 dependencies
  • chore(deps): bump tough-cookie from 2.3.2 to 2.3.4 dependencies
  • chore(deps): bump concat-with-sourcemaps from 1.0.4 to 1.1.0 dependencies
  • chore(deps): bump stringstream from 0.0.5 to 0.0.6 dependencies
  • chore(deps): bump lodash from 4.17.4 to 4.17.15 dependencies
  • chore(deps): bump clean-css from 4.1.8 to 4.1.11 dependencies
  • chore(deps): bump extend from 3.0.1 to 3.0.2 dependencies
  • chore(deps): bump macaddress from 0.2.8 to 0.2.9 dependencies
  • chore(deps): bump lodash.merge from 4.6.1 to 4.6.2 dependencies
  • chore(deps): bump sshpk from 1.13.1 to 1.16.1 dependencies

1.2.8 (2019-10-02)

Bumps tar from 2.2.1 to 2.2.2.

1.2.7 (2019-08-15)

1.2.6 (2019-08-15)

1.2.5 (2019-08-06)

1.2.4 (2019-07-14)

1.2.3 (2019-06-11)

1.2.2 (2019-03-27)

1.2.1 (2019-03-27)

  • Added component modes. Default is normal. Can be changed via mode prop. Available modes:
    • normal - input and calendar can be used as usual
    • readOnly - input cannot be changed, calendar can be opened but selection is disabled
    • calendarOnly - input cannot be changed, calendar works as usual

1.2.0 (2019-01-09)

  • Isolated component styles in the .react-month-picker selector