Fix SLDateTime day-of-week calculation

Turns out we were offsetting the wrong direction. This offsets the correct way (verified against a Wireshark capture of the official app).
This commit is contained in:
2022-04-15 16:17:18 -05:00
parent de8bba63a0
commit e0136a01cd
3 changed files with 6 additions and 6 deletions

View File

@ -153,9 +153,9 @@ exports.SLMessage = class SLMessage extends SmartBuffer {
writeSLDateTime(date) {
this.writeInt16LE(date.getFullYear());
this.writeInt16LE(date.getMonth() + 1);
var dayOfWeek = date.getDay() - 1;
if (dayOfWeek < 0) {
dayOfWeek = 6;
var dayOfWeek = date.getDay() + 1;
if (dayOfWeek == 7) {
dayOfWeek = 0;
}
this.writeInt16LE(dayOfWeek);
this.writeInt16LE(date.getDate());