File tree Expand file tree Collapse file tree
packages/ecc-client-ga4gh-drs/src/components/objects-list Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,7 +95,9 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
9595 this . pageSize ,
9696 this . currentPage - 1
9797 ) ;
98- this . objects = this . sortObjectsByLastUpdated ( result . objects ) ;
98+ this . objects = ECCClientGa4ghDrsObjects . sortObjectsByLastUpdated (
99+ result . objects
100+ ) ;
99101
100102 // Update total objects and pages from API response
101103 if ( result . pagination ?. total !== undefined ) {
@@ -166,12 +168,12 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
166168 this . loadData ( ) ;
167169 }
168170
169- private sortObjectsByLastUpdated ( objects : DrsObject [ ] ) : DrsObject [ ] {
171+ private static sortObjectsByLastUpdated ( objects : DrsObject [ ] ) : DrsObject [ ] {
170172 return [ ...objects ] . sort ( ( a , b ) => {
171173 // Use updated_time if available, otherwise fall back to created_time
172174 const aTime = a . updated_time || a . created_time ;
173175 const bTime = b . updated_time || b . created_time ;
174-
176+
175177 // Sort in reverse chronological order (most recent first)
176178 return new Date ( bTime ) . getTime ( ) - new Date ( aTime ) . getTime ( ) ;
177179 } ) ;
@@ -354,14 +356,14 @@ export class ECCClientGa4ghDrsObjects extends LitElement {
354356
355357 private static formatDateTime ( dateString : string ) : string {
356358 try {
357- return new Date ( dateString ) . toLocaleString ( ' en-US' , {
358- year : ' numeric' ,
359- month : ' 2-digit' ,
360- day : ' 2-digit' ,
361- hour : ' 2-digit' ,
362- minute : ' 2-digit' ,
363- second : ' 2-digit' ,
364- hour12 : false
359+ return new Date ( dateString ) . toLocaleString ( " en-US" , {
360+ year : " numeric" ,
361+ month : " 2-digit" ,
362+ day : " 2-digit" ,
363+ hour : " 2-digit" ,
364+ minute : " 2-digit" ,
365+ second : " 2-digit" ,
366+ hour12 : false ,
365367 } ) ;
366368 } catch {
367369 return dateString ;
You can’t perform that action at this time.
0 commit comments