Skip to content

Commit

Permalink
Debug logging displays the wrong month.
Browse files Browse the repository at this point in the history
This is caused because Date.getMonth() returns a 0-based month index.
The fix is to add 1 for calendar month index.

Tested on a benjamin, OS-13.1
jtuckerfubo committed Jun 25, 2024
1 parent 0db3fde commit da46703
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/src/OnDeviceComponent.ts
Original file line number Diff line number Diff line change
@@ -1019,7 +1019,7 @@ export class OnDeviceComponent {
private debugLog(message: string, ...args) {
if (this.getConfig()?.clientDebugLogging) {
const date = new Date;
const formattedDate = `${utils.lpad(date.getMonth())}-${utils.lpad(date.getDate())} ${utils.lpad(date.getHours())}:${utils.lpad(date.getMinutes())}:${utils.lpad(date.getSeconds())}:${utils.lpad(date.getMilliseconds(), 3)}`;
const formattedDate = `${utils.lpad(date.getMonth() + 1)}-${utils.lpad(date.getDate())} ${utils.lpad(date.getHours())}:${utils.lpad(date.getMinutes())}:${utils.lpad(date.getSeconds())}:${utils.lpad(date.getMilliseconds(), 3)}`;
console.log(`${formattedDate} [ODC][${this.device.getCurrentDeviceConfig().host}] ${message}`, ...args);
}
}

0 comments on commit da46703

Please sign in to comment.