mirror of
https://github.com/OBKoro1/autoCommit.git
synced 2024-11-22 10:29:23 +08:00
时间处理
This commit is contained in:
parent
156b01fbed
commit
0a954792ab
34
src/index.js
34
src/index.js
@ -2,7 +2,7 @@
|
||||
* Author : OBKoro1
|
||||
* Date : 2019-12-19 20:23:57
|
||||
* LastEditors : OBKoro1
|
||||
* LastEditTime : 2019-12-20 15:47:40
|
||||
* LastEditTime : 2019-12-20 18:54:45
|
||||
* FilePath : /autoCommit/index.js
|
||||
* Description : 自动commit
|
||||
* https://github.com/OBKoro1
|
||||
@ -16,11 +16,39 @@ class autoCommit {
|
||||
constructor() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
getData() {
|
||||
let time1 = '2019-01-02';
|
||||
let time2 = '2019-01-10';
|
||||
this.getAll(time1, time2);
|
||||
}
|
||||
formatTime(time) {
|
||||
return `${time} 08:00`;
|
||||
}
|
||||
getAll(begin, end) {
|
||||
let timeArr = []; // TODO: 时间段
|
||||
const beginSplit = begin.split('-');
|
||||
const endSplit = end.split('-');
|
||||
const beginDate = new Date();
|
||||
beginDate.setUTCFullYear(beginSplit[0], beginSplit[1] - 1, beginSplit[2]);
|
||||
const endDate = new Date();
|
||||
endDate.setUTCFullYear(endSplit[0], endSplit[1] - 1, endSplit[2]);
|
||||
const beginNumber = beginDate.getTime();
|
||||
const endNumber = endDate.getTime();
|
||||
for (var k = timeNumber; k <= endNumber; ) {
|
||||
console.log(new beginNumber(parseInt(k)).format());
|
||||
k = k + 24 * 60 * 60 * 1000;
|
||||
}
|
||||
}
|
||||
init() {
|
||||
this.getData();
|
||||
const time = moment().format('DD/MM/YYYY HH:MM:ss');
|
||||
let time3 = moment('2019-01-02 08:00').format();
|
||||
console.log('time', time2, time3);
|
||||
fs.writeFileSync('./test.md', time, 'utf-8');
|
||||
this.commit();
|
||||
// this.commit();
|
||||
}
|
||||
getTime() {
|
||||
return '';
|
||||
}
|
||||
commit() {
|
||||
// git commit --amend --date="2019-01-02T00:00:00+0800" -am 'autoCommit'
|
||||
|
Loading…
Reference in New Issue
Block a user