community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1872511 - in /comdev/reporter.apache.org/trunk/site/wizard/js: source/reportdate.js wizard.js
Date Wed, 08 Jan 2020 18:47:48 GMT
Author: humbedooh
Date: Wed Jan  8 18:47:48 2020
New Revision: 1872511

URL: http://svn.apache.org/viewvc?rev=1872511&view=rev
Log:
fix shadowing

Modified:
    comdev/reporter.apache.org/trunk/site/wizard/js/source/reportdate.js
    comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/reportdate.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/reportdate.js?rev=1872511&r1=1872510&r2=1872511&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/reportdate.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/reportdate.js Wed Jan  8 18:47:48
2020
@@ -86,7 +86,7 @@ function getReportDate(json, pmc, dateOn
 		}
 	}
 	// find the first Wed that has not been reached
-	var nextdate = dates[0];
+	let nextdate = dates[0];
 	while (nextdate < today && dates.length > 0) {
 		nextdate = dates.shift();
 	}
@@ -94,13 +94,14 @@ function getReportDate(json, pmc, dateOn
 	if (dateOnly) {
 		// agenda date or due date?
 		if (dateOnly == "due") {
-			nextdate.setDate(nextdate.getDate() - 7); // Due one week prior to meeting.
+			let xdate = new Date(+nextdate); // copy so as to not decrement multiple times
+			xdate.setDate(xdate.getDate() - 7); // Due one week prior to meeting.
 			let rightnow = new Date();
-			if (nextdate < rightnow) {
-				if (pdata && pdata.filed[pmc] == true) return new HTML('span', {style: { color:
'#396'}}, nextdate.toDateString() + " (Report filed)");
-				return new HTML('span', {style: { color: '#711'}}, nextdate.toDateString() + " (Report
is due)");
+			if (xdate < rightnow) {
+				if (pdata && pdata.filed[pmc] == true) return new HTML('span', {style: { color:
'#396'}}, xdate.toDateString() + " (Report filed)");
+				return new HTML('span', {style: { color: '#711'}}, xdate.toDateString() + " (Report is
due)");
 			}
-			return nextdate ? (nextdate.toDateString() + " ("  + moment(nextdate).fromNow() + ")"):
"Unknown(?)";
+			return xdate ? (xdate.toDateString() + " ("  + moment(xdate).fromNow() + ")"): "Unknown(?)";
 		} else {
 			return nextdate ? (nextdate.toDateString() + " ("  + moment(nextdate).fromNow() + ")"):
"Unknown(?)";
 		}

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js?rev=1872511&r1=1872510&r2=1872511&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Wed Jan  8 18:47:48 2020
@@ -1985,7 +1985,7 @@ function getReportDate(json, pmc, dateOn
 		}
 	}
 	// find the first Wed that has not been reached
-	var nextdate = dates[0];
+	let nextdate = dates[0];
 	while (nextdate < today && dates.length > 0) {
 		nextdate = dates.shift();
 	}
@@ -1993,13 +1993,14 @@ function getReportDate(json, pmc, dateOn
 	if (dateOnly) {
 		// agenda date or due date?
 		if (dateOnly == "due") {
-			nextdate.setDate(nextdate.getDate() - 7); // Due one week prior to meeting.
+			let xdate = new Date(+nextdate); // copy so as to not decrement multiple times
+			xdate.setDate(xdate.getDate() - 7); // Due one week prior to meeting.
 			let rightnow = new Date();
-			if (nextdate < rightnow) {
-				if (pdata && pdata.filed[pmc] == true) return new HTML('span', {style: { color:
'#396'}}, nextdate.toDateString() + " (Report filed)");
-				return new HTML('span', {style: { color: '#711'}}, nextdate.toDateString() + " (Report
is due)");
+			if (xdate < rightnow) {
+				if (pdata && pdata.filed[pmc] == true) return new HTML('span', {style: { color:
'#396'}}, xdate.toDateString() + " (Report filed)");
+				return new HTML('span', {style: { color: '#711'}}, xdate.toDateString() + " (Report is
due)");
 			}
-			return nextdate ? (nextdate.toDateString() + " ("  + moment(nextdate).fromNow() + ")"):
"Unknown(?)";
+			return xdate ? (xdate.toDateString() + " ("  + moment(xdate).fromNow() + ")"): "Unknown(?)";
 		} else {
 			return nextdate ? (nextdate.toDateString() + " ("  + moment(nextdate).fromNow() + ")"):
"Unknown(?)";
 		}



Mime
View raw message