77 KdsModal ,
88 KdsRadioButtonGroup ,
99} from " @knime/kds-components" ;
10- import { formatDateString } from " @knime/utils" ;
10+ import { formatDateTimeString } from " @knime/utils" ;
1111
1212import {
1313 ItemVersion ,
@@ -67,6 +67,19 @@ type DropdownOption = {
6767
6868const MAX_DESCRIPTION_LENGTH = 120 ;
6969
70+ const formatCreatedOn = (createdOnValue : string | Date ) => {
71+ const date =
72+ createdOnValue instanceof Date ? createdOnValue : new Date (createdOnValue );
73+ if (Number .isNaN (date .getTime ())) {
74+ const rawValue =
75+ createdOnValue instanceof Date ? null : createdOnValue .trim ();
76+ return rawValue ? ` Created on ${rawValue } ` : " Created on unknown date" ;
77+ }
78+ const dateInput =
79+ createdOnValue instanceof Date ? date .getTime () : createdOnValue ;
80+ return ` Created on ${formatDateTimeString (dateInput )} ` ;
81+ };
82+
7083const dropdownOptions = computed <DropdownOption []>(() =>
7184 itemVersions .value
7285 .filter (
@@ -77,13 +90,7 @@ const dropdownOptions = computed<DropdownOption[]>(() =>
7790 const title = version .title ?? " Untitled" ;
7891 const author = version .author ? ` Author: ${version .author } ` : null ;
7992 const createdOnValue = version .createdOn ;
80- const createdOn = createdOnValue
81- ? ` Created: ${formatDateString (
82- createdOnValue instanceof Date
83- ? createdOnValue .toISOString ()
84- : createdOnValue ,
85- )} `
86- : null ;
93+ const createdOn = createdOnValue ? formatCreatedOn (createdOnValue ) : null ;
8794 const rawDescription = version .description ?.trim () ?? " " ;
8895 let description: string | null = null ;
8996 if (rawDescription .length > 0 ) {
0 commit comments