11import React from 'react' ;
22import PropTypes from 'prop-types' ;
33import { Input } from 'semantic-ui-react' ;
4- import { formatDate , omit , pick } from '../utils' ;
5- import { semanticInputProps } from '../data' ;
4+ import { formatDate , omit , pick , moveElementsByN } from '../utils' ;
5+ import { monthNamesEng , semanticInputProps , weekdayNamesEng } from '../data' ;
66import Calendar from '../components/calendar' ;
77import DatePicker from '../dayzed-pickers/DatePicker' ;
88import BaseInput from './index' ;
@@ -17,14 +17,18 @@ class SimpleInput extends BaseInput {
1717 static propTypes = {
1818 date : PropTypes . instanceOf ( Date ) ,
1919 format : PropTypes . string ,
20+ monthNames : PropTypes . array ,
2021 onDateChange : PropTypes . func . isRequired ,
2122 placeholder : PropTypes . string ,
23+ weekdayNames : PropTypes . array ,
2224 } ;
2325
2426 static defaultProps = {
2527 date : undefined ,
2628 format : 'YYYY-MM-DD' ,
29+ monthNames : monthNamesEng ,
2730 placeholder : null ,
31+ weekdayNames : weekdayNamesEng ,
2832 } ;
2933
3034 state = initialState ;
@@ -63,9 +67,16 @@ class SimpleInput extends BaseInput {
6367 } ;
6468 }
6569
70+ get weekdayNames ( ) {
71+ const { firstDayOfWeek } = this . dayzedProps ;
72+ const { weekdayNames } = this . props ;
73+
74+ return moveElementsByN ( firstDayOfWeek , weekdayNames ) ;
75+ }
76+
6677 render ( ) {
6778 const { isVisible, selectedDate, selectedDateFormatted } = this . state ;
68- const { date } = this . props ;
79+ const { date, monthNames } = this . props ;
6980
7081 return (
7182 < div
@@ -88,7 +99,13 @@ class SimpleInput extends BaseInput {
8899 selected = { selectedDate }
89100 date = { selectedDate || date }
90101 >
91- { props => < Calendar { ...props } /> }
102+ { props => (
103+ < Calendar
104+ { ...props }
105+ monthNames = { monthNames }
106+ weekdayNames = { this . weekdayNames }
107+ />
108+ ) }
92109 </ DatePicker >
93110 ) }
94111 </ div >
0 commit comments