diff --git a/lib/profile/profileeditor.js b/lib/profile/profileeditor.js index 90babf6681f..9a9062603c1 100644 --- a/lib/profile/profileeditor.js +++ b/lib/profile/profileeditor.js @@ -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' }, @@ -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' }, diff --git a/lib/profilefunctions.js b/lib/profilefunctions.js index bf5d9b09d3b..e5dafe45275 100644 --- a/lib/profilefunctions.js +++ b/lib/profilefunctions.js @@ -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 () { diff --git a/webpack/webpack.config.js b/webpack/webpack.config.js index 9d8cb268711..5fb24daabdc 100644 --- a/webpack/webpack.config.js +++ b/webpack/webpack.config.js @@ -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, '..'); /* @@ -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');