Fix dates mismatch issue where dates for observation’s displayed in the Graph and Table view’s don’t match the observation’s effectiveDateTime as received by the app from service. #43
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.
Issue : The open source version of growth chart has a mismatch in the observations (i.e height, weight etc) being displayed on the Graph and Table Views. After some investigation, the issue seems to be with the way the app processes date for an observation.
The app converts the
dateString
received from the resource call intoAge in Months
using the XDate library. Then the app converts theAge in Months
back to adateString
for displaying it on the Graph and Table View for that observation. The XDate library computes thisdateString
incorrectly thus resulting in a date which could be off by a few days from the actual date of the observation.More Info on this Issue : #35
Fix : This PR fixes the display to consume the
effectiveDateTime
received with the observation as a string. We pass down a separate keydateString
with the application's object for observations and use it later on to display the string directly thus avoiding any conversions using the XDate library. This does not affect any calculation in the application.Consideration: This fix uses a new variable
dateString
and does not alter any of the apps existing logic to handle a date object for an observation. This helps in keeping thedateString
of the observation's completely separate from any calculations/computations in the app.