Skip to content

Commit

Permalink
[view] refacto the fix #c7f57a0 by using the native Date option
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolab committed Aug 13, 2016
1 parent fa9d3d9 commit 4dbe134
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions lib/local-history-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ LocalHistoryView.prototype.saveRevision = function saveRevision(buffer) {
now = new Date();
day = '' + now.getDate();
month = '' + (now.getMonth() + 1);
hour = '' + now.getHours(); //24-hours format
minute = '' + now.getMinutes();
second = '' + now.getSeconds();
pathDirName = path.dirname(buffer.file.path);

if (day.length === 1) {
Expand All @@ -208,25 +205,11 @@ LocalHistoryView.prototype.saveRevision = function saveRevision(buffer) {
month = '0' + month;
}

if (hour.length === 1) {
hour = '0' + hour;
}

if (minute.length === 1) {
minute = '0' + minute;
}

if (second.length === 1) {
second = '0' + second;
}

// YYYY-mm-dd_HH-ii-ss_basename
revFileName = now.getFullYear() +
'-' + month +
'-' + day +
'_' + hour +
'-' + minute +
'-' + second +
'_' + now.toLocaleTimeString({hour12: false}).replace(/:/g, '-') +
'_' + path.basename(buffer.file.path)
;

Expand Down

0 comments on commit 4dbe134

Please sign in to comment.