Acknowledged
over 1 year ago

getStressHistory crashing

Hi, good day to all.
I'm running the code below to get today's stress data:
var clockTime = Time.Gregorian.info(Time.now(), Time.FORMAT_MEDIUM);
var midnight = new Time.Duration(clockTime.hour*3600 + clockTime.min*60 + clockTime.sec);
var stressIterator = SensorHistory.getStressHistory({ :period => midnight, :order => Sen.ORDER_OLDEST_FIRST});
It works fine and give me what I want almost always, however, when it's shortly after midnight (00:00, 00:01, etc) it crashes. The crash is at the third line of the above snippet, it says only:
Error: Invalid Value
Details: Failed invoking <symbol>
Notice that I'm simply requesting stress history and saving the return to a variable. At this point I'm not trying to access a property of "can be null" entity. This happens both in the simulator and physical device (Venu 2). To reproduce this error, I set the computer clock to 00:00:00 and run it.
Thanks in advance.