44 *--------------------------------------------------------------------------------------------*/
55
66import * as nls from 'vscode-nls' ;
7- import * as dayjs from 'dayjs' ;
8- import * as advancedFormat from 'dayjs/plugin/advancedFormat' ;
9- import { CancellationToken , Disposable , Event , EventEmitter , ThemeIcon , Timeline , TimelineChangeEvent , TimelineItem , TimelineOptions , TimelineProvider , Uri , workspace } from 'vscode' ;
7+ import { CancellationToken , Disposable , env , Event , EventEmitter , ThemeIcon , Timeline , TimelineChangeEvent , TimelineItem , TimelineOptions , TimelineProvider , Uri , workspace } from 'vscode' ;
108import { Model } from './model' ;
119import { Repository , Resource } from './repository' ;
1210import { debounce } from './decorators' ;
1311
14- dayjs . extend ( advancedFormat ) ;
15-
1612const localize = nls . loadMessageBundle ( ) ;
1713
18- // TODO@eamodio : Localize or use a setting for date format
19-
2014export class GitTimelineItem extends TimelineItem {
2115 static is ( item : TimelineItem ) : item is GitTimelineItem {
2216 return item instanceof GitTimelineItem ;
@@ -145,16 +139,15 @@ export class GitTimelineProvider implements TimelineProvider {
145139 commits . splice ( commits . length - 1 , 1 ) ;
146140 }
147141
148- let dateFormatter : dayjs . Dayjs ;
142+ const dateFormatter = new Intl . DateTimeFormat ( env . language , { year : 'numeric' , month : 'long' , day : 'numeric' , hour : 'numeric' , minute : 'numeric' } ) ;
143+
149144 const items = commits . map < GitTimelineItem > ( ( c , i ) => {
150145 const date = c . commitDate ; // c.authorDate
151146
152- dateFormatter = dayjs ( date ) ;
153-
154147 const item = new GitTimelineItem ( c . hash , commits [ i + 1 ] ?. hash ?? `${ c . hash } ^` , c . message , date ?. getTime ( ) ?? 0 , c . hash , 'git:file:commit' ) ;
155148 item . iconPath = new ( ThemeIcon as any ) ( 'git-commit' ) ;
156149 item . description = c . authorName ;
157- item . detail = `${ c . authorName } (${ c . authorEmail } ) \u2014 ${ c . hash . substr ( 0 , 8 ) } \n${ dateFormatter . format ( 'MMMM Do, YYYY h:mma' ) } \n\n${ c . message } ` ;
150+ item . detail = `${ c . authorName } (${ c . authorEmail } ) \u2014 ${ c . hash . substr ( 0 , 8 ) } \n${ dateFormatter . format ( date ) } \n\n${ c . message } ` ;
158151 item . command = {
159152 title : 'Open Comparison' ,
160153 command : 'git.timeline.openDiff' ,
@@ -170,13 +163,12 @@ export class GitTimelineProvider implements TimelineProvider {
170163 const index = repo . indexGroup . resourceStates . find ( r => r . resourceUri . fsPath === uri . fsPath ) ;
171164 if ( index ) {
172165 const date = this . repoStatusDate ?? new Date ( ) ;
173- dateFormatter = dayjs ( date ) ;
174166
175167 const item = new GitTimelineItem ( '~' , 'HEAD' , localize ( 'git.timeline.stagedChanges' , 'Staged Changes' ) , date . getTime ( ) , 'index' , 'git:file:index' ) ;
176168 // TODO@eamodio : Replace with a better icon -- reflecting its status maybe?
177169 item . iconPath = new ( ThemeIcon as any ) ( 'git-commit' ) ;
178170 item . description = '' ;
179- item . detail = localize ( 'git.timeline.detail' , '{0} \u2014 {1}\n{2}\n\n{3}' , you , localize ( 'git.index' , 'Index' ) , dateFormatter . format ( 'MMMM Do, YYYY h:mma' ) , Resource . getStatusText ( index . type ) ) ;
171+ item . detail = localize ( 'git.timeline.detail' , '{0} \u2014 {1}\n{2}\n\n{3}' , you , localize ( 'git.index' , 'Index' ) , dateFormatter . format ( date ) , Resource . getStatusText ( index . type ) ) ;
180172 item . command = {
181173 title : 'Open Comparison' ,
182174 command : 'git.timeline.openDiff' ,
@@ -189,13 +181,12 @@ export class GitTimelineProvider implements TimelineProvider {
189181 const working = repo . workingTreeGroup . resourceStates . find ( r => r . resourceUri . fsPath === uri . fsPath ) ;
190182 if ( working ) {
191183 const date = new Date ( ) ;
192- dateFormatter = dayjs ( date ) ;
193184
194185 const item = new GitTimelineItem ( '' , index ? '~' : 'HEAD' , localize ( 'git.timeline.uncommitedChanges' , 'Uncommited Changes' ) , date . getTime ( ) , 'working' , 'git:file:working' ) ;
195186 // TODO@eamodio : Replace with a better icon -- reflecting its status maybe?
196187 item . iconPath = new ( ThemeIcon as any ) ( 'git-commit' ) ;
197188 item . description = '' ;
198- item . detail = localize ( 'git.timeline.detail' , '{0} \u2014 {1}\n{2}\n\n{3}' , you , localize ( 'git.workingTree' , 'Working Tree' ) , dateFormatter . format ( 'MMMM Do, YYYY h:mma' ) , Resource . getStatusText ( working . type ) ) ;
189+ item . detail = localize ( 'git.timeline.detail' , '{0} \u2014 {1}\n{2}\n\n{3}' , you , localize ( 'git.workingTree' , 'Working Tree' ) , dateFormatter . format ( date ) , Resource . getStatusText ( working . type ) ) ;
199190 item . command = {
200191 title : 'Open Comparison' ,
201192 command : 'git.timeline.openDiff' ,
0 commit comments