As far as I can tell action=compare doesn't support a timestamp prop, which, at least to me, it seems like it should (returning fromtime and totime or the like).
Seems straightforward enough. I'd recommend naming them fromtimestamp and totimestamp though.
To complete this task, most of the changes would be to ApiComparePages.php:
- Add 'timestamp' as an option in the array at lines 717–727.
- Add code to setVals() similar to that at lines 588–590 to put the timestamp in the result when requested.
- You'd use $rev->getTimestamp() to fetch the timestamp from the revision, and use wfTimestamp() to convert it to TS_ISO_8601 format. You may also need to handle the case where $rev->getTimestamp() returns null, likely to avoid setting the response property at all.
- Add appropriate tests to ApiComparePagesTest.php.
Change 587316 had a related patch set uploaded (by Vd; owner: Vd):
[mediawiki/core@master] Added timestamp to action=compare \n\nAdded timestamp props to ApiComparePages.php with value setting only occuring when getTimestamp() does not return null. Added appropriate tests to ApiComparePagesTest.php. \n\nFeature: T247686