From 9870d4da6439cf83776fb522148d279425ec9675 Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@gmail.com> Date: Thu, 26 Dec 2019 23:45:51 +0100 Subject: [PATCH] revert asDate() --- src/js/utilsFC.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/js/utilsFC.js b/src/js/utilsFC.js index 2b8fea7f87e..d9d63199da3 100644 --- a/src/js/utilsFC.js +++ b/src/js/utilsFC.js @@ -1187,12 +1187,25 @@ window.years = function(weeks) { return r; }; -window.asDate = function(weeks, bonusDay = 0) { +/** + * @param {number} [weeks] + * @param {number} [bonusDay] + * @return {Date} + */ +window.asDate = function(weeks = null, bonusDay = 0) { + if (weeks == null) { + weeks = State.variables.week; + } let d = new Date(2037, 0, 12); d.setDate(d.getDate() + weeks * 7 + bonusDay); return d; }; -window.asDateString = function(weeks, bonusDay = 0) { +/** + * @param {number} [weeks] + * @param {number} [bonusDay] + * @return {string} + */ +window.asDateString = function(weeks = null, bonusDay = 0) { return asDate(weeks, bonusDay).toLocaleString(undefined, {year: 'numeric', month: 'long', day: 'numeric'}); }; -- GitLab