I have determined that the dates can be changed in the assets/js/admin/reports.min.js file, but for the life of me, I cannot understand what in that file to change to make it show the correct months.
I have tested this csv export function in my dev site and it outputs the correct dates, so maybe you should check first that you have the current version of WC and in particular reports.min.js. Maybe the last update did not fully complete.
But you asked, so, line 212 in reports.js is:
csv_data += date.getFullYear() + "-" + parseInt( date.getMonth() + 1 ) + ',';
To make the month in the csv go forward by 1, change the + 1 to + 2.
Copy and paste reports.js into reports.min.js. If it does what you want, you can optionally save a few bytes by using one of the several online compression tools, for example:
http://jscompress.com/
Thanks so very much lorro.
I do indeed have the latest version of Woocommerce. I even overwrote both files with a fresh downloaded copy.
I copied the entirety of reports.js over that of reports.min.js (and changed the +1 to +2). It now shows November as the last month in the first column with the correct sales data.
However, the first month in the list shows 2013-13 as opposed to 2014-1. Here is the leftmost column:
Date
2013-13
2014-2
2014-3
2014-4
2014-5
2014-6
2014-7
2014-8
2014-9
2014-10
2014-11
Thanks so much for all your help.
OK, so replace line 212 with this snippet:
// csv_data += date.getFullYear() + "-" + parseInt( date.getMonth() + 1 ) + ',';
var year = date.getFullYear();
var month = parseInt( date.getMonth() + 2 , 10);
if ( month == 13 ) {
month = 1;
year = year + 1;
}
csv_data += year + "-" + month + ',';
Sorry not tested but should not be far off.
Haha! It worked like a charm!
I can’t thank you enough. It’s one of those things that just picks away at you until it’s solved.
Now more of a rhetorical question here, but why is it that others aren’t experiencing this very same aberrance?
Thanks again!
Brenn
P.S. The same problem occurs when I export the CSV based on monthly reports or a daily date range but I think I will be able to fix those now with your direction.
The usual debug recommendations are deactivate all plugins, and try the default theme.
BTW, The changes above will be overwritten by a WC update.
Yes indeed, I was sure to back up the JS files in case of an update. Thanks!