File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
packages/core/src/components/DatePicker Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ type Props = {
5757 borderColor ?: string ;
5858 borderColorActive ?: string ;
5959 autoDismissKeyboard ?: boolean ;
60- minimumDate ?: Date ;
61- maximumDate ?: Date ;
60+ minimumDate ?: Date | string ;
61+ maximumDate ?: Date | string ;
6262} & IconSlot &
6363 TextInputProps ;
6464
@@ -531,8 +531,8 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
531531 mode = { mode }
532532 isVisible = { pickerVisible }
533533 toggleVisibility = { toggleVisibility }
534- minimumDate = { minimumDate }
535- maximumDate = { maximumDate }
534+ minimumDate = { parseDate ( minimumDate ) }
535+ maximumDate = { parseDate ( maximumDate ) }
536536 onChange = { ( _event : any , data : any ) => {
537537 toggleVisibility ( ) ;
538538 setValue ( data ) ;
@@ -583,4 +583,11 @@ const styles = StyleSheet.create({
583583 } ,
584584} ) ;
585585
586+ function parseDate ( date ?: string | Date ) {
587+ if ( typeof date === "string" ) {
588+ return new Date ( date ) ;
589+ }
590+ return date ;
591+ }
592+
586593export default withTheme ( DatePicker ) ;
You can’t perform that action at this time.
0 commit comments