Page MenuHomePhabricator

Xtools calculation of number of days, as presented on the result page (web/html interface), is erroneous
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:
Example URL is https://xtools.wmflabs.org/adminstats/de.wikipedia.org/2021-01-01/2021-01-20?actions=import
Note: The project (de.wikipedia.org) and actions (import) are not relevant to the bug, this is just an example.

Actual Results: The result page states:
Starting date: 2021-01-01
Ending date: 2021-01-20 (19 days)

Expected Results: The result page should state:
Starting date: 2021-01-01
Ending date: 2021-01-20 (20 days)

If the starting date equals the ending date, it states (0 days) but obviuosly actions for 1 day (i.e. 24 hours) are included in the result.

This error in the calculation of number of days seems to be common to a number of Xtools functions such as "Admin Stats", "Patroller Stats" and "Steward Stats" where the number of days is calculated and displayed as above. I don't know if it affects any statistics where this faulty number might be used for the calculation of some averages such as "average number of actions per day" or similar. If the faulty calculation of number of days is done in one single place, it should be easy to correct
from ending_date-starting_date
to ending_date-starting-date+1