Skip to content

Commit

Permalink
Merge branch 'wip/bewest/daytoday-redo-03' of github.com:nightscout/c…
Browse files Browse the repository at this point in the history
…gm-remote-monitor into wip/bewest/daytoday-redo-03
  • Loading branch information
bewest committed Jan 24, 2023
2 parents 0ee0712 + 6a543c8 commit 8e0ec88
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
25 changes: 23 additions & 2 deletions lib/profile/profileeditor.js
Expand Up @@ -564,7 +564,20 @@ var init = function init () {
$('#pe_delay_high').val(c_profile.delay_high);
$('#pe_delay_medium').val(c_profile.delay_medium);
$('#pe_delay_low').val(c_profile.delay_low);
timezoneInput.val(c_profile.timezone);

// find the right zone regardless of string case

var foundCase = c_profile.timezone;

if (foundCase != "") {
var lcZone = c_profile.timezone.toLowerCase();

client.ctx.timezones.forEach(function testCase(tz) {
if (tz.toLowerCase() == lcZone) foundCase = tz;
});
}

timezoneInput.val(foundCase);

var index;
[ { prefix:'pe_basal', array:'basal' },
Expand Down Expand Up @@ -601,7 +614,15 @@ var init = function init () {
c_profile.delay_high = parseInt($('#pe_delay_high').val());
c_profile.delay_medium = parseInt($('#pe_delay_medium').val());
c_profile.delay_low = parseInt($('#pe_delay_low').val());
c_profile.timezone = timezoneInput.val();

// If the zone in the profile matches the editor profile
// but case is different, preserve case

var zone = timezoneInput.val();

if (c_profile.timezone.toLowerCase() == timezoneInput.val().toLowerCase()) zone = c_profile.timezone;

c_profile.timezone = zone;

var index;
[ { prefix:'pe_basal', array:'basal' },
Expand Down
5 changes: 4 additions & 1 deletion lib/profilefunctions.js
Expand Up @@ -175,7 +175,10 @@ var moment = ctx.moment;
};

profile.getTimezone = function getTimezone (spec_profile) {
return profile.getCurrentProfile(null, spec_profile)['timezone'];
let rVal = profile.getCurrentProfile(null, spec_profile)['timezone'];
// Work around Loop uploading non-ISO compliant time zone string
if (rVal) rVal.replace('ETC','Etc');
return rVal;
};

profile.hasData = function hasData () {
Expand Down
4 changes: 1 addition & 3 deletions webpack/webpack.config.js
Expand Up @@ -2,7 +2,7 @@ const path = require('path');
const webpack = require('webpack');
const pluginArray = [];
const sourceMapType = 'source-map';
//const MomentTimezoneDataPlugin = require('moment-timezone-data-webpack-plugin');
const MomentTimezoneDataPlugin = require('moment-timezone-data-webpack-plugin');
const projectRoot = path.resolve(__dirname, '..');

/*
Expand Down Expand Up @@ -56,14 +56,12 @@ pluginArray.push(new webpack.ProvidePlugin({
process: 'process/browser',
}));

/*
// limit Timezone data from Moment

pluginArray.push(new MomentTimezoneDataPlugin({
startYear: 2015,
endYear: 2035,
}));
*/

if (process.env.NODE_ENV === 'development') {
const ESLintPlugin = require('eslint-webpack-plugin');
Expand Down

0 comments on commit 8e0ec88

Please sign in to comment.