Developmint / npm-stats-api

Fetch stats for your NPM packages
MIT License
15 stars 1 forks source link

Get alltime stats #1

Closed freekmurze closed 7 years ago

freekmurze commented 7 years ago

Is it possible to get stats starting from a given date? Eg. give me a total of downloads of a package starting from 1/1/2014?

manniL commented 7 years ago

Yeah, this is possible by using a range from 1/1/2015 (which is the earliest date provided) to the current date (which can be found out programmatically):

$currentDate = (new \DateTime)->format("Y-m-d");
$npmStats->getStats('vue-save-state', "2015-01-01:{$currentDate}");

PS: I'll add a passing test for that one in a second.