This is a very light component that makes it possible to select a year and a month and automatically sets the day to the first day of the month then it returns the correspondent Javascript Date Object;
The component's width is responsive, it takes the width of the parent element.
npm install react-simple-month-picker --save
import React from 'react';
import ReactDOM from 'react-dom';
import MonthPicker from 'react-simple-month-picker';
ReactDOM.render(<MonthPicker onChange={(date)=>{console.log(date);}} />,
document.getElementById('root')
);
When the user selects a month the value can be retreived by the props function [onChange].
Prop | is Required ? | Description |
---|---|---|
function : onChange | false | A callback function that is executed on month selection |
Array: months | false | A JavaScript Array of Strings that must be of length 12, the array represents the months names, by default it's set to ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] |
For any suggestion you can open in issue here.
MIT