You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by hu...@apache.org on 2023/03/15 17:06:56 UTC
svn commit: r1908418 - in /comdev/reporter.apache.org/trunk/site/wizard/js: source/reportdate.js wizard.js
Author: humbedooh
Date: Wed Mar 15 17:06:56 2023
New Revision: 1908418
URL: http://svn.apache.org/viewvc?rev=1908418&view=rev
Log:
Temporary fix to date shifts while we sort out a permanent solution
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=1908418&r1=1908417&r2=1908418&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 Mar 15 17:06:56 2023
@@ -1,6 +1,10 @@
// Grabbed from old reporter.a.o
// return all the Wednesdays in the month
+const reporting_date_shifts = { // Dates that are known to have shifted by N weeks
+ "2023-03": 1 // shifted by 1 week
+}
+
function getWednesdays(mo, y) {
var d = new Date();
d.setFullYear(y, mo, 1)
@@ -17,7 +21,12 @@ function getWednesdays(mo, y) {
wednesdays.push(new Date(d.getTime()));
d.setDate(d.getDate() + 7);
}
-
+ // Check for shifts, adjust if found
+ d.setMonth(mo);
+ const caldate = moment(d).format('YYYY-MM');
+ if (reporting_date_shifts[caldate]) {
+ wednesdays = wednesdays.slice(reporting_date_shifts[caldate]);
+ }
return wednesdays;
}
// check if the entry is a wildcard month
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=1908418&r1=1908417&r2=1908418&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Wed Mar 15 17:06:56 2023
@@ -1901,6 +1901,10 @@ function prime_steps(state, json) {
// Grabbed from old reporter.a.o
// return all the Wednesdays in the month
+const reporting_date_shifts = { // Dates that are known to have shifted by N weeks
+ "2023-03": 1 // shifted by 1 week
+}
+
function getWednesdays(mo, y) {
var d = new Date();
d.setFullYear(y, mo, 1)
@@ -1917,7 +1921,12 @@ function getWednesdays(mo, y) {
wednesdays.push(new Date(d.getTime()));
d.setDate(d.getDate() + 7);
}
-
+ // Check for shifts, adjust if found
+ d.setMonth(mo);
+ const caldate = moment(d).format('YYYY-MM');
+ if (reporting_date_shifts[caldate]) {
+ wednesdays = wednesdays.slice(reporting_date_shifts[caldate]);
+ }
return wednesdays;
}
// check if the entry is a wildcard month