@@ -6,6 +6,7 @@ import { DatePickerInput } from '../forms/input/DatePickerInput';
66import {
77 formatDate ,
88 formatDateTime ,
9+ getJsonTimeFormatString ,
910 getTimeValueFromDatePickerInput ,
1011 isDateTimeCol
1112} from '../../util/Date' ;
@@ -39,20 +40,22 @@ export const DateInputCell: FC<DateInputCellProps> = memo(props => {
3940 } , [ colIdx , rowIdx , select ] ) ;
4041
4142 const onDateInputChange = useCallback (
42- ( newDate : Date | string , formatted ?: string ) => {
43- let display = formatted ;
44- if ( ! display ) {
45- if ( newDate && typeof newDate === 'string' ) display = newDate ;
46- else if ( newDate && newDate instanceof Date ) {
47- display = col . isTimeColumn
48- ? getTimeValueFromDatePickerInput ( newDate , col )
49- : isDateTimeCol ( col )
50- ? formatDateTime ( newDate )
51- : formatDate ( newDate ) ;
43+ ( newDate : Date | string ) => {
44+ let display , raw = newDate ;
45+ if ( newDate && typeof newDate === 'string' ) display = newDate ;
46+ else if ( newDate && newDate instanceof Date ) {
47+ if ( col . isTimeColumn ) {
48+ raw = getJsonTimeFormatString ( newDate ) ;
49+ display = getTimeValueFromDatePickerInput ( newDate , col ) ;
50+ }
51+ else {
52+ display = isDateTimeCol ( col )
53+ ? formatDateTime ( newDate )
54+ : formatDate ( newDate ) ;
5255 }
5356 }
5457
55- modifyCell ( colIdx , rowIdx , [ { raw : col . isTimeColumn ? display : newDate , display } ] , MODIFICATION_TYPES . REPLACE , col ) ;
58+ modifyCell ( colIdx , rowIdx , [ { raw, display } ] , MODIFICATION_TYPES . REPLACE , col ) ;
5659 } ,
5760 [ col , colIdx , modifyCell , rowIdx ]
5861 ) ;
0 commit comments