different last month meaning
-
Hi team,
in includes/class-wp-statistics-helper.php mysql_time_conditions() are hard values for relative time ranges like month and year. For example:
case 'last-month':
$fromDate = TimeZone::getTimeAgo(60, 'Y-m-d');
$toDate = TimeZone::getTimeAgo(30, 'Y-m-d');So i get different numbers if i use shortcodes like
[wpstatistics stat=visitors time=last-month]
[wpstatistics stat=visits time=last-month]wich is currently 2024-05-30 – 2024-06-30 or if i use the time range option “Last Month” in ?page=wps_hits_page wich directly link to ?page=wps_hits_page&from=2024-06-01&to=2024-06-30
This results in different numbers.
Same with
- “last-week” wich is not -7 days but “from start to end of the last week-1”
- “last-two-weeks” wich is not -14 days but “from start to end of the week-2”
- “month” wich is not always -30 days because of date(‘t’)
- “year” wich is not always -365 days because of date(‘L’)
On the other hand “60days” (-60) and “2-weeks-ago” (-21) for example are correct.
Would it be better to calculate the mysql_time_conditions() relative to the current date like in strtotime()?
Best,
Rico
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘different last month meaning’ is closed to new replies.