lanjingling0510 / react-mobile-datepicker

🙊 👻 look a demo, Please imitate mobile environment.
https://codepen.io/lanjingling0510/pen/LRpOYp?editors=1010
MIT License
301 stars 145 forks source link

Map month number to month name #26

Closed magom001 closed 6 years ago

magom001 commented 6 years ago

Need to add an option to convert month number to month name.

E.g.:

const monthMap = { 0: 'Jan', 1: 'Feb', 2: 'March', }

<DatePicker dateFormat={['YYYY', ['MM', (month) => monthMap(month)], 'DD']} />

lanjingling0510 commented 6 years ago

@magom001 I have added this feature in react-mobile-datepicker@3.0.11

It's used like this:


            const monthMap = {
                '01': 'Jan',
                '02': 'Feb',
                '03': 'Mar',
                '04': 'Apr',
                '05': 'May',
                '06': 'Jun',
                '07': 'Jul',
                '08': 'Aug',
                '09': 'Sep',
                '10': 'Oct',
                '11': 'Nov',
                '12': 'Dec',
            };

            <DatePicker
                  dateFormat={['YYYY', ['MM', (month) => monthMap[month]], 'DD']}
            />