@@ -107,9 +107,39 @@ function showDetails(data, connected) {
107107 details_top . appendChild ( description ) ;
108108 // URLs
109109 link_heading = document . createElement ( "h3" ) ;
110- link_heading . innerHTML = "Links " ;
110+ link_heading . innerHTML = "Infos " ;
111111 let tool_links = data [ "urls" ] ;
112112 details_bottom . appendChild ( link_heading ) ;
113+ const release_div = document . createElement ( "div" ) ;
114+ release_div . classList . add ( "text-primary" , "mb-2" ) ;
115+ const version = data [ "release" ] [ "version" ] || "?" ;
116+ const release_date = data [ "release" ] [ "published" ] ;
117+ release_div . innerHTML = `Latest release: <b>${ version } </b>` ;
118+ if ( release_date !== undefined ) {
119+ const date = new Date ( release_date ) ;
120+ const now = new Date ( ) ;
121+ const diff = ( now - date ) / ( 24 * 60 * 60 * 1000 ) ; // in days
122+ let time_since = "" ;
123+ if ( diff < 30 ) {
124+ time_since = "< 1 month ago" ;
125+ } else if ( diff < 60 ) {
126+ time_since = "1 month ago" ;
127+ }
128+ else if ( diff < 365 ) {
129+ time_since = `${ Math . floor ( diff / 30 ) } months ago` ;
130+ }
131+ else if ( diff < 365 * 1.5 ) {
132+ time_since = `1 year ago` ;
133+ }
134+ else if ( diff < 365 * 2 ) {
135+ time_since = `1 year ago` ;
136+ } else {
137+ time_since = `${ Math . floor ( diff / 365 ) } years ago` ;
138+ }
139+
140+ release_div . innerHTML += ` (${ date . toLocaleDateString ( "en-US" , { year : 'numeric' , month : 'long' , day : 'numeric' } ) } ; ${ time_since } )` ;
141+ }
142+ details_bottom . appendChild ( release_div ) ;
113143 const flex_div = document . createElement ( "div" ) ;
114144 flex_div . classList . add ( "d-flex" , "flex-wrap" ) ;
115145 const btnClasses = [ "btn-primary" , "btn-success" , "btn-warning" ] ;
0 commit comments