feat: convert from using dst offsets to use timezone code
feat: select timezones from current selected country
This commit is contained in:
parent
cc8c48ff4c
commit
7d6fb17158
16 changed files with 86 additions and 117 deletions
|
|
@ -18,6 +18,8 @@ const { getCustomerById } = require('../customers')
|
|||
const machineLoader = require('../machine-loader')
|
||||
const { loadLatestConfig } = require('../new-settings-loader')
|
||||
|
||||
const { zonedTimeToUtc, utcToZonedTime } = require('date-fns-tz')
|
||||
|
||||
function updateCustomer (req, res, next) {
|
||||
const id = req.params.id
|
||||
const machineVersion = req.query.version
|
||||
|
|
@ -129,14 +131,12 @@ function buildSms (data, receiptOptions) {
|
|||
.then(([customer, deviceConfig]) => {
|
||||
const formattedTx = _.mapKeys(_.camelCase)(tx)
|
||||
const localeConfig = configManager.getLocale(formattedTx.deviceId, config)
|
||||
const timezone = localeConfig.timezone.split(':')
|
||||
const dstOffset = timezone[1]
|
||||
const timezone = localeConfig.timezone
|
||||
|
||||
const cashInCommission = new BN(1).plus(new BN(formattedTx.commissionPercentage))
|
||||
|
||||
const rate = new BN(formattedTx.rawTickerPrice).multipliedBy(cashInCommission).decimalPlaces(2)
|
||||
const date = new Date()
|
||||
date.setMinutes(date.getMinutes() + parseInt(dstOffset))
|
||||
const date = utcToZonedTime(zonedTimeToUtc(new Date(), process.env.TZ), timezone)
|
||||
const dateString = `${date.toISOString().replace('T', ' ').slice(0, 19)}`
|
||||
|
||||
const data = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue