diff --git a/README.md b/README.md index 6a90ea77f80483f74d0228a3dd5f4330815b2798..0c5fc4eae6288793b345094fef2406cf2f8d2ba6 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ A React Native bridge module for interacting with [Apple HealthKit] data. * [initHealthKit](#inithealthkit) * [getStepCountForToday](#getstepcountfortoday) * [getStepCountForDay](#getstepcountforday) + * [getMultiDayStepCounts](#getmultidaystepcounts) * [getLatestWeight](#getlatestweight) * [saveWeight](#saveweight) * [getLatestHeight](#getlatestheight) @@ -204,6 +205,34 @@ AppleHealthKit.getStepCountForDay(options, (err, steps) => { ___ +#### **`getMultiDayStepCounts`** +get the total steps per day over a specified date range. + +`getMultiDayStepCounts` accepts an options object containing *`startDate: ISO8601Timestamp`*, and optional *`endDate: ISO8601Timestamp`* fields. if `endDate` is not provided it will default to the current time +```javascript +let options = { + startDate: (new Date(2016,5,1)).toISOString() // required + endDate: (new Date()).toISOString() // optional; default now +}; +``` +The function will be called with an array of elements `res` containing date and step count information +```javascript + AppleHealthKit.getMultiDayStepCounts(options, (err: Object, res: Array>) => { + if(this._handleHealthKitError(err, 'getMultiDayStepCounts')){ + return; + } + // 'res' is array of [ISOTimestamp: string, stepCount: number] arrays + // sorted ascending from startDate through endDate (default now) + for(let i=0; i