Skip to content

Commit 4b10496

Browse files
committed
Convert time to milliseconds before passing it to the callback in commit.time. Closes nodegit#62
1 parent a134965 commit 4b10496

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/commit.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Commit.prototype.message = function(callback) {
106106
};
107107

108108
/**
109-
* Retrieve the commit time as a unix timestamp in seconds.
109+
* Retrieve the commit time as a unix timestamp.
110110
*
111111
* @param {Commit~timeCallback} callback
112112
*/
@@ -118,7 +118,8 @@ Commit.prototype.time = function(callback) {
118118
*/
119119
this.rawCommit.time(function(error, time) {
120120
if (success(error, callback)) {
121-
callback(null, time);
121+
// git_commit_time returns timestamp in s, converting to ms here
122+
callback(null, time * 1000);
122123
}
123124
});
124125
};
@@ -136,7 +137,7 @@ Commit.prototype.date = function(callback) {
136137
*/
137138
this.time(function(error, time) {
138139
if (success(error, callback)) {
139-
callback(null, new Date(time * 1000));
140+
callback(null, new Date(time));
140141
}
141142
});
142143
};

0 commit comments

Comments
 (0)