compute fractional year in same time zone as model #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The fractional year time computation in
model.js
was using local dates, thevalueOf
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.