-
-
Notifications
You must be signed in to change notification settings - Fork 2
properly adjust localtime according to localTimezone, if present #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ewollesen
wants to merge
1
commit into
master
Choose a base branch
from
eric-localtime
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addLocalTimenow setslocalTimeto a string (moment(...).format()), but the XLSX writer config treatslocalTimeas a date field (cellFormatin config.json) and relies on ExcelJS receiving aDateto applynumFmt. As-is,localTimewill be written as text in XLSX (formatting/sorting as dates won’t work). Consider either (a) keepinglocalTimeas aDatefor XLSX output (e.g., convert it to aDateinxlsxStreamWritersimilarly totime/deviceTime/computerTime), or (b) if the intent is to preserve the timezone offset in the exported value, update the XLSX path/config to explicitly treatlocalTimeas text and use a consistent string format.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ewollesen This comment is largely correct. The call stack in here gets pretty convoluted:
Example Flow for localTime
Config defines: "localTime": { "cellFormat": "yyyy-mm-dd hh:mm:ss" } (config.json)
Cache stores: cellFormat['smbg']['localTime'] = "yyyy-mm-dd hh:mm:ss" (TidepoolDataTools.cache)
Processing: addLocalTime() creates a JavaScript Date object
Column setup: cellFormat('smbg', 'localTime', { bgUnits: 'mmol/L' }) returns the Excel format string
ExcelJS applies the
numFmtto format the Date when writing the cellSo currently the rest of the processing is expecting that value to be a
Date()and not a string and may need to be adjusted accordingly (in the config) if we want to move over to a preformatted string from theDate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krystophv based on Slack discussion that I wasn't aware of, I've updated the Jira ticket and posted a new PR (#26).