Skip to content

Commit 430b725

Browse files
authored
Merge pull request #77 from ioet/TT-482-Fix-timeEntries-offsets
Fix: Time entries offsets
2 parents 6cfa7d5 + 77ec46b commit 430b725

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

nodejs-functions/src/handlers/automatic-clock-outs/clock_out.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const doClockOut = async (context) => {
4848
}
4949
timeEntryAsJson.end_date = timeEntry.getTimeToClockOutMidnight();
5050
await container.item(timeEntryAsJson.id, timeEntryAsJson.tenant_id).replace(timeEntryAsJson);
51+
totalClockOutsExecuted++;
5152
}
5253
})
5354
);

nodejs-functions/src/handlers/automatic-clock-outs/package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodejs-functions/src/handlers/automatic-clock-outs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"dependencies": {
1010
"@azure/cosmos": "3.5.2",
1111
"@azure/msal-node": "^1.0.0-alpha.5",
12+
"@slack/web-api": "^6.0.0",
1213
"axios": "^0.20.0",
13-
"dotenv": "^8.2.0",
14+
"dotenv": "^16.0.0",
1415
"moment": "^2.27.0",
15-
"@slack/web-api": "^6.0.0",
1616
"msal": "^1.4.0"
1717
},
1818
"author": "",

nodejs-functions/src/handlers/automatic-clock-outs/time_entry.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ class TimeEntry {
1515
}
1616

1717
getMidnightInTimeEntryZone(){
18-
return moment(this.timeEntry.start_date).utc()
19-
.subtract(this.timeEntry.timezone_offset, 'minutes').endOf('day');
18+
return moment(this.timeEntry.start_date).utcOffset(this.timeEntry.timezone_offset * -1).endOf('day');
2019
}
2120

2221
getTimeToClockOutMidnight(){
23-
return moment().utc().endOf('day').toISOString();
22+
return moment(this.timeEntry.start_date).utcOffset(this.timeEntry.timezone_offset * -1).endOf('day').toISOString();
2423
}
2524

2625
getCurrentTimeInTimeEntryZone(){

0 commit comments

Comments
 (0)