File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
components/InfoViewer/formatters Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import {createInfoFormatter} from '../utils';
77export const formatCommonItem = createInfoFormatter < TDirEntry > ( {
88 values : {
99 PathType : ( value ) => value ?. substring ( 'EPathType' . length ) ,
10- CreateStep : ( value ) => ( Number ( value ) ? formatDateTime ( value ) : EMPTY_DATA_PLACEHOLDER ) ,
10+ CreateStep : ( value ) => formatDateTime ( value , { defaultValue : EMPTY_DATA_PLACEHOLDER } ) ,
1111 } ,
1212 labels : {
1313 PathType : i18n ( 'common.type' ) ,
Original file line number Diff line number Diff line change @@ -215,6 +215,11 @@ export const formatDateTime = (
215215 value ?: number | string ,
216216 { withTimeZone, defaultValue = '' } : { withTimeZone ?: boolean ; defaultValue ?: string } = { } ,
217217) => {
218+ // prevent 1970-01-01 03:00
219+ if ( ! Number ( value ) ) {
220+ return defaultValue ;
221+ }
222+
218223 const tz = withTimeZone ? ' z' : '' ;
219224 const formattedData = dateTimeParse ( Number ( value ) ) ?. format ( `YYYY-MM-DD HH:mm${ tz } ` ) ;
220225
You can’t perform that action at this time.
0 commit comments