1- import { Strings } from '../system' ;
1+ import { Dates , Strings } from '../system' ;
22import { DecorationInstanceRenderOptions , DecorationOptions , MarkdownString , ThemableDecorationRenderOptions } from 'vscode' ;
33import { DiffWithCommand , ShowQuickCommitDetailsCommand } from '../commands' ;
44import { IThemeConfig , themeDefaults } from '../configuration' ;
55import { GlyphChars } from '../constants' ;
66import { CommitFormatter , GitCommit , GitDiffChunkLine , GitService , GitUri , ICommitFormatOptions } from '../gitService' ;
7- import * as moment from 'moment' ;
87
98interface IHeatmapConfig {
109 enabled : boolean ;
@@ -28,13 +27,13 @@ const escapeMarkdownRegEx = /[`\>\#\*\_\-\+\.]/g;
2827
2928export class Annotations {
3029
31- static applyHeatmap ( decoration : DecorationOptions , date : Date , now : moment . Moment ) {
30+ static applyHeatmap ( decoration : DecorationOptions , date : Date , now : number ) {
3231 const color = this . _getHeatmapColor ( now , date ) ;
3332 ( decoration . renderOptions ! . before ! as any ) . borderColor = color ;
3433 }
3534
36- private static _getHeatmapColor ( now : moment . Moment , date : Date ) {
37- const days = now . diff ( moment ( date ) , 'days' ) ;
35+ private static _getHeatmapColor ( now : number , date : Date ) {
36+ const days = Dates . dateDaysFromNow ( date , now ) ;
3837
3938 if ( days <= 2 ) return '#ffeca7' ;
4039 if ( days <= 7 ) return '#ffdd8c' ;
@@ -65,7 +64,7 @@ export class Annotations {
6564 message = `\n\n> ${ message } ` ;
6665 }
6766
68- const markdown = new MarkdownString ( `[\`${ commit . shortSha } \`](${ ShowQuickCommitDetailsCommand . getMarkdownCommandArgs ( commit . sha ) } ) __${ commit . author } __, ${ moment ( commit . date ) . fromNow ( ) } _(${ moment ( commit . date ) . format ( dateFormat ) } )_${ message } ` ) ;
67+ const markdown = new MarkdownString ( `[\`${ commit . shortSha } \`](${ ShowQuickCommitDetailsCommand . getMarkdownCommandArgs ( commit . sha ) } ) __${ commit . author } __, ${ commit . fromNow ( ) } _(${ commit . formatDate ( dateFormat ) } )_${ message } ` ) ;
6968 markdown . isTrusted = true ;
7069 return markdown ;
7170 }
0 commit comments