Fix day-of-week handling again

Saturday isn't 0, it's 7.

Add tests to make sure this is working now and forever!
This commit is contained in:
2022-04-17 10:47:45 -05:00
parent 79bff51c17
commit c95c9f8ce5
2 changed files with 27 additions and 5 deletions

View File

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