Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit cb43bde

Browse files
committed
fix config overriding gitlabs default hours per day. fix #83
1 parent 2434032 commit cb43bde

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/models/hasTimes.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ class hasTimes extends Base {
8282
if(subMatch && subMatch[2]) created = moment(subMatch[2]);
8383

8484
// create a time string and a time object
85-
let timeString = match ? match[1] : (subMatch ? `-${subMatch[1]}` : `-${Time.toHumanReadable(timeSpent, this.config.get('hoursPerDay'))}`);
86-
let time = new Time(timeString, created, note, this, this.config);
85+
let timeString = match ? match[1] : (subMatch ? `-${subMatch[1]}` : `-${Time.toHumanReadable(timeSpent)}`);
86+
let time = new Time(null, created, note, this, this.config);
87+
time.seconds = Time.parse(timeString, 8, 5, 4);
8788

8889
// add to total time spent
8990
totalTimeSpent += time.seconds;
@@ -142,4 +143,4 @@ class hasTimes extends Base {
142143
}
143144
}
144145

145-
module.exports = hasTimes;
146+
module.exports = hasTimes;

src/models/time.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ class time {
2929
this._date = date;
3030
this.parent = parent;
3131
this.config = config;
32+
33+
if(!timeString) {
34+
return;
35+
}
36+
3237
this.seconds = time.parse(timeString, this._hoursPerDay, this._daysPerWeek, this._weeksPerMonth);
3338
}
3439

0 commit comments

Comments
 (0)