Skip to content

Commit 802bfec

Browse files
committed
Prevent showing the Moment deprecation log
1 parent 50656a3 commit 802bfec

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

bin/git-stats

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ var GitStats = require("../lib")
99
, GitStatsColors = require("git-stats-colors")
1010
;
1111

12-
// Configure logger
12+
// Configurations
1313
Logger.config.displayDate = false;
1414
Logger.config.logLevel = 4;
15-
16-
// Constants
15+
Moment.suppressDeprecationWarnings = true;
1716

1817
// CLI options
1918
switch (process.argv[2]) {
@@ -35,21 +34,27 @@ switch (process.argv[2]) {
3534
console.log(require("../package.json").version);
3635
break;
3736
default:
38-
var options = {
39-
start: Moment().subtract(1, "years")
40-
, end: Moment()
41-
};
37+
var options = {};
4238

4339
if (process.argv.length !== 2) {
4440
if (process.argv[2]) {
4541
options.start = Moment(process.argv[2]);
42+
4643
}
4744

4845
if (process.argv[3]) {
4946
options.end = Moment(process.argv[3]);
5047
}
5148
}
5249

50+
if (!options.start || !options.start.isValid()) {
51+
options.start = Moment().subtract(1, "years");
52+
}
53+
54+
if (!options.end || !options.end.isValid()) {
55+
options.end = Moment();
56+
}
57+
5358
GitStats.ansiCalendar(options, function (err, data) {
5459
if (err) { return Logger.log(err, "error"); }
5560
data = AnsiParser.removeAnsi(data);

0 commit comments

Comments
 (0)