Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sleep Time Series Date/Time

When using the Sleep Time Series (available if you're creating a personal app) the dateTime is always given in hours, minutes and seconds without the date.

 

        56 => array:2 [          "dateTime" => "23:59:30"
          "value" => "3"
        ]
        57 => array:2 [          "dateTime" => "00:00:30"
          "value" => "3"
        ]

 

When trying to save this info it's difficult to save the timestamp because the date needs to be worked out.

 

Example Scenario:

 

If the sleep starts at 11pm, as you loop through you can save the date using

 

sleep.dateOfSleep + minuteData.dateTime

This will give you: 2016-01-06 23:00:00 for instance.

 

However once it passes midnight you'll have figure that out and add one day to dateOfSleep before appending the time.

 

However you cannot assume that anything before midday needs to have one day added to it because the sleep might begin after midnight. Or the sleep might start in the early hours of the morning and go until after midday.

 

Essentially it makes it really complicated to save the timestamp and this could be really easily solved just by adding the date to dateTime instead of just showing the time.

 

Is there any reason this can't be implemented?

Best Answer
1 REPLY 1

@RobBrain wrote:

Is there any reason this can't be implemented?


I agree that it would be better as a fully qualified date, but it would be a backwards incompatible change that breaks every existing app that uses this endpoint.

 

You can use `startTime` to find the starting day.

Best Answer
0 Votes