Skip to content

Commit 6ee8b6a

Browse files
committed
Fix default date format string at startup
Not sure what happened when I tried to do this in 39133b1, but evaluating `DEFAULT_DATE` at import time doesn't work because `atom.config.get` returns undefined. So calculate it later and cache it. Test Plan: Reloaded window then opened blame in a big file. Saw my preferred datestring and not the full ISO 8601 format.
1 parent 692fbf1 commit 6ee8b6a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/util/blameFormatter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function parseCommitter(line) {
2828
*/
2929
function formatDate(date) {
3030
var formatString = atom.config.get('git-blame.dateFormatString');
31+
console.log(formatString);
3132
return date.format(formatString);
3233
}
3334

lib/views/blame-line-view.coffee

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ moment = require 'moment'
66

77
HASH_LENGTH = 7 # github uses this length
88
BLANK_HASH = '-'.repeat(HASH_LENGTH)
9-
DEFAULT_DATE = formatDate moment("2000-01-01T13:17:00 Z")
9+
10+
_defaultDate = null
11+
getDefaultDate = ->
12+
_defaultDate ?= formatDate moment("2014-01-01T13:37:00 Z")
1013

1114

1215
renderLoading = ->
1316
div className: 'blame-line loading',
1417
span className: 'hash', BLANK_HASH
15-
span className: 'date', DEFAULT_DATE
18+
span className: 'date', getDefaultDate()
1619
span className: 'committer', 'Loading'
1720

1821

0 commit comments

Comments
 (0)