From e9c3fb1e272acfbe26e239ca4a6180efb291c887 Mon Sep 17 00:00:00 2001 From: Llywelwyn <82828093+Llywelwyn@users.noreply.github.com> Date: Tue, 19 Apr 2022 00:38:20 +0100 Subject: [PATCH] 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 --- code/modules/goonchat/browserassets/js/browserOutput.js | 2 +- html/changelogs/llywelwyn-save-chat-log-date-fix.yml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 html/changelogs/llywelwyn-save-chat-log-date-fix.yml diff --git a/code/modules/goonchat/browserassets/js/browserOutput.js b/code/modules/goonchat/browserassets/js/browserOutput.js index 1146c8b98d8..979299c1d5d 100644 --- a/code/modules/goonchat/browserassets/js/browserOutput.js +++ b/code/modules/goonchat/browserassets/js/browserOutput.js @@ -933,7 +933,7 @@ $(function() { var blob = new Blob(['Chat Log', $messages.html(), '']); 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'; diff --git a/html/changelogs/llywelwyn-save-chat-log-date-fix.yml b/html/changelogs/llywelwyn-save-chat-log-date-fix.yml new file mode 100644 index 00000000000..08641c98faa --- /dev/null +++ b/html/changelogs/llywelwyn-save-chat-log-date-fix.yml @@ -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."