diff --git a/lib/config-migration.js b/lib/config-migration.js index bd5d1c10..52d4b7d2 100644 --- a/lib/config-migration.js +++ b/lib/config-migration.js @@ -129,7 +129,8 @@ function migrateLocales (config) { country: 'country', fiatCurrency: 'fiatCurrency', machineLanguages: 'languages', - cryptoCurrencies: 'cryptoCurrencies' + cryptoCurrencies: 'cryptoCurrencies', + timezone: 'timezone' } const { global, scoped } = getConfigFields(_.keys(codes), config) diff --git a/migrations/1620319260238-timezones.js b/migrations/1620319260238-timezones.js new file mode 100644 index 00000000..5c024d4b --- /dev/null +++ b/migrations/1620319260238-timezones.js @@ -0,0 +1,18 @@ +const _ = require('lodash/fp') +const settingsLoader = require('../lib/new-settings-loader') + +exports.up = function (next) { + settingsLoader.loadLatest() + .then(({ config }) => { + if (!_.isEmpty(config)) + config.locale.timezone = '0:0' + return settingsLoader.saveConfig(config) + }) + .then(() => next()) + .catch(err => next(err)) + +} + +exports.down = function (next) { + next() +} diff --git a/new-lamassu-admin/src/pages/Locales/helper.js b/new-lamassu-admin/src/pages/Locales/helper.js index 3bc00ffa..3b5bec72 100644 --- a/new-lamassu-admin/src/pages/Locales/helper.js +++ b/new-lamassu-admin/src/pages/Locales/helper.js @@ -42,6 +42,8 @@ const allFields = (getData, onChange, auxElements = []) => { const tzLabels = getTzLabels(timezonesData) + console.log(tzLabels) + const findSuggestion = it => { const machine = R.find(R.propEq('deviceId', it.machine))(machineData) return machine ? [machine] : [] @@ -63,7 +65,7 @@ const allFields = (getData, onChange, auxElements = []) => { }, { name: 'country', - width: 150, + width: 200, size: 'sm', view: getView(countryData, 'display'), input: Autocomplete, @@ -87,7 +89,7 @@ const allFields = (getData, onChange, auxElements = []) => { }, { name: 'languages', - width: 240, + width: 200, size: 'sm', view: displayCodeArray(languageData), input: Autocomplete, @@ -165,7 +167,7 @@ const LocaleSchema = Yup.object().shape({ .label('Crypto Currencies') .required() .min(1), - timezone: Yup.object() + timezone: Yup.string() .label('Timezone') .required() }) diff --git a/new-lamassu-admin/src/utils/timezones.js b/new-lamassu-admin/src/utils/timezones.js index 75f187f8..d42ecce5 100644 --- a/new-lamassu-admin/src/utils/timezones.js +++ b/new-lamassu-admin/src/utils/timezones.js @@ -70,7 +70,7 @@ const buildLabel = tz => { const getTzLabels = timezones => R.map( - it => ({ label: buildLabel(it), code: it }), + it => ({ label: buildLabel(it), code: `${it.utcOffset}:${it.dstOffset}` }), getFinalTimezones(timezones) )