mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Profile now defaults to local time zone. Works in the client but will break on the server. Time zone and units field added to documentation.
This commit is contained in:
@@ -312,6 +312,8 @@ Use the [autoconfigure tool][autoconfigure] to sync an uploader to your config.
|
||||
|
||||
Treatment Profile Fields:
|
||||
|
||||
* `timezone` (Time Zone) - time zone local to the patient. *Should be set.*
|
||||
* `units` (Profile Units) - blood glucose units used in the profile, either "mgdl" or "mmol"
|
||||
* `dia` (Insulin duration) - value should be the duration of insulin action to use in calculating how much insulin is left active. Defaults to 3 hours.
|
||||
* `carbs_hr` (Carbs per Hour) - The number of carbs that are processed per hour, for more information see [#DIYPS](http://diyps.org/2014/05/29/determining-your-carbohydrate-absorption-rate-diyps-lessons-learned/).
|
||||
* `carbratio` (Carb Ratio) - grams per unit of insulin.
|
||||
|
||||
@@ -39,15 +39,13 @@ function init(profileData) {
|
||||
|
||||
profile.getValueByTime = function getValueByTime (time, valueContainer) {
|
||||
if (!time) { time = Date.now(); }
|
||||
var tz = 'UTC';
|
||||
if (profile.getTimezone()) {
|
||||
tz = profile.getTimezone();
|
||||
}
|
||||
|
||||
// Assumes the timestamps are in UTC
|
||||
// Use local time zone if profile doesn't contain a time zone
|
||||
// This WILL break on the server; added warnings elsewhere that this is missing
|
||||
// TODO: Better warnings to user for missing configuration
|
||||
|
||||
// correctly converts both Dates and timestamps
|
||||
// assume all timestamps are UTC, convert to local time
|
||||
// Dates convert correctly every time, assuming correct time zone
|
||||
var t = moment(time).tz(tz);
|
||||
var t = profile.getTimezone() ? moment(time).tz(profile.getTimezone()) : moment(time);
|
||||
|
||||
// Convert to seconds from midnight
|
||||
var mmtMidnight = t.clone().startOf('day');
|
||||
|
||||
Reference in New Issue
Block a user