@@ -140,8 +140,8 @@ const Datepicker: React.FC<Props> = ({
140
140
141
141
const secondGotoDate = useCallback (
142
142
( date : dayjs . Dayjs ) => {
143
- const newDate = dayjs ( formatDate ( date ) ) ;
144
- const reformatDate = dayjs ( formatDate ( firstDate ) ) ;
143
+ const newDate = dayjs ( formatDate ( date , displayFormat ) ) ;
144
+ const reformatDate = dayjs ( formatDate ( firstDate , displayFormat ) ) ;
145
145
if ( newDate . isSame ( reformatDate ) || newDate . isBefore ( reformatDate ) ) {
146
146
setFirstDate ( previousMonth ( date ) ) ;
147
147
}
@@ -214,8 +214,8 @@ const Datepicker: React.FC<Props> = ({
214
214
validDate && ( startDate . isSame ( endDate ) || startDate . isBefore ( endDate ) ) ;
215
215
if ( condition ) {
216
216
setPeriod ( {
217
- start : formatDate ( startDate ) ,
218
- end : formatDate ( endDate )
217
+ start : formatDate ( startDate , displayFormat ) ,
218
+ end : formatDate ( endDate , displayFormat )
219
219
} ) ;
220
220
setInputText (
221
221
`${ formatDate ( startDate , displayFormat ) } ${
@@ -233,6 +233,19 @@ const Datepicker: React.FC<Props> = ({
233
233
}
234
234
} , [ asSingle , value , displayFormat , separator ] ) ;
235
235
236
+ useEffect ( ( ) => {
237
+ if ( startFrom && dayjs ( startFrom ) . isValid ( ) ) {
238
+
239
+ if ( value != null && value . startDate != null ) {
240
+ setFirstDate ( dayjs ( value . startDate ) )
241
+ setSecondDate ( nextMonth ( dayjs ( value . startDate ) ) )
242
+ } else {
243
+ setFirstDate ( dayjs ( startFrom ) )
244
+ setSecondDate ( nextMonth ( dayjs ( startFrom ) ) )
245
+ }
246
+ }
247
+ } , [ startFrom , value ] )
248
+
236
249
// Variable
237
250
const colorPrimary = useMemo ( ( ) => {
238
251
if ( COLORS . includes ( primaryColor ) ) {
0 commit comments