@@ -65,40 +65,7 @@ import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/b
65
65
import { ViewContainerLocation } from 'vs/workbench/common/views' ;
66
66
import { flatten } from 'vs/base/common/arrays' ;
67
67
import { isBoolean } from 'vs/base/common/types' ;
68
-
69
- function getRelativeDateLabel ( date : Date ) : string {
70
- const delta = new Date ( ) . getTime ( ) - date . getTime ( ) ;
71
-
72
- const year = 365 * 24 * 60 * 60 * 1000 ;
73
- if ( delta > year ) {
74
- const noOfYears = Math . floor ( delta / year ) ;
75
- return noOfYears > 1 ? localize ( 'noOfYearsAgo' , "{0} years ago" , noOfYears ) : localize ( 'one year ago' , "1 year ago" ) ;
76
- }
77
-
78
- const month = 30 * 24 * 60 * 60 * 1000 ;
79
- if ( delta > month ) {
80
- const noOfMonths = Math . floor ( delta / month ) ;
81
- return noOfMonths > 1 ? localize ( 'noOfMonthsAgo' , "{0} months ago" , noOfMonths ) : localize ( 'one month ago' , "1 month ago" ) ;
82
- }
83
-
84
- const day = 24 * 60 * 60 * 1000 ;
85
- if ( delta > day ) {
86
- const noOfDays = Math . floor ( delta / day ) ;
87
- return noOfDays > 1 ? localize ( 'noOfDaysAgo' , "{0} days ago" , noOfDays ) : localize ( 'one day ago' , "1 day ago" ) ;
88
- }
89
-
90
- const hour = 60 * 60 * 1000 ;
91
- if ( delta > hour ) {
92
- const noOfHours = Math . floor ( delta / day ) ;
93
- return noOfHours > 1 ? localize ( 'noOfHoursAgo' , "{0} hours ago" , noOfHours ) : localize ( 'one hour ago' , "1 hour ago" ) ;
94
- }
95
-
96
- if ( delta > 0 ) {
97
- return localize ( 'just now' , "Just now" ) ;
98
- }
99
-
100
- return '' ;
101
- }
68
+ import { fromNow } from 'vs/base/common/date' ;
102
69
103
70
export class PromptExtensionInstallFailureAction extends Action {
104
71
@@ -1175,7 +1142,7 @@ export class InstallAnotherVersionAction extends ExtensionAction {
1175
1142
return {
1176
1143
id : v . version ,
1177
1144
label : v . version ,
1178
- description : `${ getRelativeDateLabel ( new Date ( Date . parse ( v . date ) ) ) } ${ v . isPreReleaseVersion ? ` (${ localize ( 'pre-release' , "pre-release" ) } )` : '' } ${ v . version === this . extension ! . version ? ` (${ localize ( 'current' , "current" ) } )` : '' } ` ,
1145
+ description : `${ fromNow ( new Date ( Date . parse ( v . date ) ) , true ) } ${ v . isPreReleaseVersion ? ` (${ localize ( 'pre-release' , "pre-release" ) } )` : '' } ${ v . version === this . extension ! . version ? ` (${ localize ( 'current' , "current" ) } )` : '' } ` ,
1179
1146
latest : i === 0 ,
1180
1147
ariaLabel : `${ v . isPreReleaseVersion ? 'Pre-Release version' : 'Release version' } ${ v . version } ` ,
1181
1148
isPreReleaseVersion : v . isPreReleaseVersion
0 commit comments