File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,14 @@ const updateInputWidth = (element) => {
3232 container . removeChild ( span ) ;
3333} ;
3434
35+ const removeUnwantedCharacters = str => str
36+ . split ( '' )
37+ // We don't want spaces in dates
38+ . filter ( a => a . charCodeAt ( 0 ) !== 32 )
39+ // Internet Explorer specific
40+ . filter ( a => a . charCodeAt ( 0 ) !== 8206 )
41+ . join ( '' ) ;
42+
3543const min = ( ...args ) => Math . min ( ...args . filter ( a => typeof a === 'number' ) ) ;
3644const max = ( ...args ) => Math . max ( ...args . filter ( a => typeof a === 'number' ) ) ;
3745
@@ -194,11 +202,7 @@ export default class DateInput extends Component {
194202 const date = new Date ( 2017 , 11 , 11 ) ;
195203
196204 return (
197- formatDate ( date )
198- . split ( '' )
199- // Internet Explorer specific
200- . filter ( a => a . charCodeAt ( 0 ) !== 8206 )
201- . join ( '' )
205+ removeUnwantedCharacters ( formatDate ( date ) )
202206 . match ( / [ ^ 0 - 9 ] / ) [ 0 ]
203207 ) ;
204208 }
@@ -216,7 +220,7 @@ export default class DateInput extends Component {
216220 const date = new Date ( 2017 , 11 , 11 ) ;
217221
218222 return (
219- formatDate ( date )
223+ removeUnwantedCharacters ( formatDate ( date ) )
220224 . replace ( '2017' , 'year' )
221225 . replace ( '12' , 'month' )
222226 . replace ( '11' , 'day' )
@@ -391,10 +395,6 @@ export default class DateInput extends Component {
391395
392396 return (
393397 placeholder
394- . split ( '' )
395- // Internet Explorer specific
396- . filter ( a => a . charCodeAt ( 0 ) !== 8206 )
397- . join ( '' )
398398 . split ( divider )
399399 . map ( ( part ) => {
400400 switch ( part ) {
You can’t perform that action at this time.
0 commit comments