geomagnetism
geomagnetism copied to clipboard
compute fractional year in same time zone as model
The fractional year time computation in model.js
was using local dates, the valueOf
which can vary greatly with the user's - or server's - local timezone. UTC dates should be used because they coincide with the proper timezone in the model itself.
This was found by noticing a slight drift in values when running unit tests in CI (GMT) vs. our local dev timezone, despite sending a constant new Date(1488386496470)
in the test itself.
That particular portion of this library is a little difficult to write a unit test for, or I would have added it. Also, this change should allow you to drastically increase the precision with which each value is tested.
I am not sure what is going on with the build there. Both test
and test-ci
pass locally for me. I am running a much newer version of node though.