@@ -18,6 +18,7 @@ import {
1818 isSameDate ,
1919 isSameWeek ,
2020 isSameQuarter ,
21+ formatValue ,
2122} from './utils/dateUtil' ;
2223import useValueTexts from './hooks/useValueTexts' ;
2324import useTextValueMapping from './hooks/useTextValueMapping' ;
@@ -229,7 +230,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
229230 const endInputRef = useRef < HTMLInputElement > ( null ) ;
230231
231232 // ============================= Misc ==============================
232- const formatList = toArray ( getDefaultFormat ( format , picker , showTime , use12Hours ) ) ;
233+ const formatList = toArray ( getDefaultFormat < DateType > ( format , picker , showTime , use12Hours ) ) ;
233234
234235 // Active picker
235236 const [ mergedActivePickerIndex , setMergedActivePickerIndex ] = useMergedState < 0 | 1 > ( 0 , {
@@ -425,11 +426,11 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
425426
426427 const startStr =
427428 values && values [ 0 ]
428- ? generateConfig . locale . format ( locale . locale , values [ 0 ] , formatList [ 0 ] )
429+ ? formatValue ( values [ 0 ] , { generateConfig , locale , format : formatList [ 0 ] } )
429430 : '' ;
430431 const endStr =
431432 values && values [ 1 ]
432- ? generateConfig . locale . format ( locale . locale , values [ 1 ] , formatList [ 0 ] )
433+ ? formatValue ( values [ 1 ] , { generateConfig , locale , format : formatList [ 0 ] } )
433434 : '' ;
434435
435436 if ( onCalendarChange ) {
@@ -515,7 +516,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
515516 ) ;
516517
517518 const onTextChange = ( newText : string , index : 0 | 1 ) => {
518- const inputDate = generateConfig . locale . parse ( locale . locale , newText , formatList ) ;
519+ const inputDate = generateConfig . locale . parse ( locale . locale , newText , formatList as string [ ] ) ;
519520
520521 const disabledFunc = index === 0 ? disabledStartDate : disabledEndDate ;
521522
@@ -989,7 +990,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
989990 }
990991
991992 const inputSharedProps = {
992- size : getInputSize ( picker , formatList [ 0 ] ) ,
993+ size : getInputSize ( picker , formatList [ 0 ] , generateConfig ) ,
993994 } ;
994995
995996 let activeBarLeft : number = 0 ;
@@ -1068,7 +1069,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
10681069 < input
10691070 id = { id }
10701071 disabled = { mergedDisabled [ 0 ] }
1071- readOnly = { inputReadOnly || ! startTyping }
1072+ readOnly = { inputReadOnly || typeof formatList [ 0 ] === 'function' || ! startTyping }
10721073 value = { startHoverValue || startText }
10731074 onChange = { e => {
10741075 triggerStartTextChange ( e . target . value ) ;
@@ -1093,7 +1094,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
10931094 >
10941095 < input
10951096 disabled = { mergedDisabled [ 1 ] }
1096- readOnly = { inputReadOnly || ! endTyping }
1097+ readOnly = { inputReadOnly || typeof formatList [ 0 ] === 'function' || ! endTyping }
10971098 value = { endHoverValue || endText }
10981099 onChange = { e => {
10991100 triggerEndTextChange ( e . target . value ) ;
0 commit comments