Fixes default date on saved chat logs (#13564)

* save chatlog fix

getMonth is 0-indexed in js for w/e reason, needs +1
getDay returns day of the week (monday = 1), not day of the month

* cl

* .yml
This commit is contained in:
Llywelwyn
2022-04-18 20:38:20 -03:00
committed by GitHub
parent 8fc56d450c
commit e9c3fb1e27
2 changed files with 7 additions and 1 deletions
@@ -933,7 +933,7 @@ $(function() {
var blob = new Blob(['<head><title>Chat Log</title><style>', styleData, '</style></head><body>', $messages.html(), '</body>']);
var fname = 'SS13 Chat Log';
var date = new Date(), month = date.getMonth(), day = date.getDay(), hours = date.getHours(), mins = date.getMinutes(), secs = date.getSeconds();
var date = new Date(), month = date.getMonth() + 1, day = date.getDate(), hours = date.getHours(), mins = date.getMinutes(), secs = date.getSeconds();
fname += ' ' + date.getFullYear() + '-' + (month < 10 ? '0' : '') + month + '-' + (day < 10 ? '0' : '') + day;
fname += ' ' + (hours < 10 ? '0' : '') + hours + (mins < 10 ? '0' : '') + mins + (secs < 10 ? '0' : '') + secs;
fname += '.html';
@@ -0,0 +1,6 @@
author: Llywelwyn
delete-after: True
changes:
- bugfix: "Fixes date when using 'save chat log'. Now gives the correct month and date."