Started adding timezone support
This commit is contained in:
parent
33e075ecdc
commit
478237e60f
14 changed files with 191 additions and 9 deletions
|
@ -21,10 +21,10 @@ let db = mysql.createPool(mysqlConfig);
|
|||
function listTables(callback) {
|
||||
db.getConnection((err, connection) => {
|
||||
if (err) {
|
||||
if(err.code === 'ER_ACCESS_DENIED_ERROR'){
|
||||
if (err.code === 'ER_ACCESS_DENIED_ERROR') {
|
||||
err = new Error('Could not access the database. Check MySQL config and authentication credentials');
|
||||
}
|
||||
if(err.code === 'ECONNREFUSED' || err.code === 'PROTOCOL_SEQUENCE_TIMEOUT'){
|
||||
if (err.code === 'ECONNREFUSED' || err.code === 'PROTOCOL_SEQUENCE_TIMEOUT') {
|
||||
err = new Error('Could not connect to the database. Check MySQL host and port configuration');
|
||||
}
|
||||
return callback(err);
|
||||
|
|
|
@ -230,7 +230,7 @@ module.exports.insert = (listId, meta, subscription, callback) => {
|
|||
let keys = [];
|
||||
let values = [];
|
||||
|
||||
let allowedKeys = ['first_name', 'last_name'];
|
||||
let allowedKeys = ['first_name', 'last_name', 'tz'];
|
||||
Object.keys(subscription).forEach(key => {
|
||||
let value = subscription[key];
|
||||
key = tools.toDbKey(key);
|
||||
|
@ -392,7 +392,8 @@ module.exports.getWithMergeTags = (listId, cid, callback) => {
|
|||
EMAIL: subscription.email,
|
||||
FIRST_NAME: subscription.firstName,
|
||||
LAST_NAME: subscription.lastName,
|
||||
FULL_NAME: [].concat(subscription.firstName || []).concat(subscription.lastName || []).join(' ')
|
||||
FULL_NAME: [].concat(subscription.firstName || []).concat(subscription.lastName || []).join(' '),
|
||||
TIMEZONE: subscription.tz || ''
|
||||
};
|
||||
|
||||
fields.getRow(fieldList, subscription, true, true).forEach(field => {
|
||||
|
@ -433,7 +434,7 @@ module.exports.update = (listId, cid, updates, allowEmail, callback) => {
|
|||
return callback(err);
|
||||
}
|
||||
|
||||
let allowedKeys = ['first_name', 'last_name'];
|
||||
let allowedKeys = ['first_name', 'last_name', 'tz'];
|
||||
|
||||
if (allowEmail) {
|
||||
allowedKeys.unshift('email');
|
||||
|
|
147
lib/tz.js
Normal file
147
lib/tz.js
Normal file
|
@ -0,0 +1,147 @@
|
|||
'use strict';
|
||||
|
||||
module.exports.list = [
|
||||
'Pacific/Midway',
|
||||
'Pacific/Samoa',
|
||||
'Pacific/Honolulu',
|
||||
'US/Alaska',
|
||||
'America/Los_Angeles',
|
||||
'America/Tijuana',
|
||||
'US/Arizona',
|
||||
'America/Chihuahua',
|
||||
'America/Chihuahua',
|
||||
'America/Mazatlan',
|
||||
'US/Mountain',
|
||||
'America/Managua',
|
||||
'US/Central',
|
||||
'America/Mexico_City',
|
||||
'America/Mexico_City',
|
||||
'America/Monterrey',
|
||||
'Canada/Saskatchewan',
|
||||
'America/Bogota',
|
||||
'US/Eastern',
|
||||
'US/East-Indiana',
|
||||
'America/Lima',
|
||||
'America/Bogota',
|
||||
'Canada/Atlantic',
|
||||
'America/Caracas',
|
||||
'America/La_Paz',
|
||||
'America/Santiago',
|
||||
'Canada/Newfoundland',
|
||||
'America/Sao_Paulo',
|
||||
'America/Argentina/Buenos_Aires',
|
||||
'America/Argentina/Buenos_Aires',
|
||||
'America/Godthab',
|
||||
'America/Noronha',
|
||||
'Atlantic/Azores',
|
||||
'Atlantic/Cape_Verde',
|
||||
'Africa/Casablanca',
|
||||
'Europe/London',
|
||||
'Etc/Greenwich',
|
||||
'Europe/Lisbon',
|
||||
'Europe/London',
|
||||
'Africa/Monrovia',
|
||||
'UTC',
|
||||
'Europe/Amsterdam',
|
||||
'Europe/Belgrade',
|
||||
'Europe/Berlin',
|
||||
'Europe/Berlin',
|
||||
'Europe/Bratislava',
|
||||
'Europe/Brussels',
|
||||
'Europe/Budapest',
|
||||
'Europe/Copenhagen',
|
||||
'Europe/Ljubljana',
|
||||
'Europe/Madrid',
|
||||
'Europe/Paris',
|
||||
'Europe/Prague',
|
||||
'Europe/Rome',
|
||||
'Europe/Sarajevo',
|
||||
'Europe/Skopje',
|
||||
'Europe/Stockholm',
|
||||
'Europe/Vienna',
|
||||
'Europe/Warsaw',
|
||||
'Africa/Lagos',
|
||||
'Europe/Zagreb',
|
||||
'Europe/Athens',
|
||||
'Europe/Bucharest',
|
||||
'Africa/Cairo',
|
||||
'Africa/Harare',
|
||||
'Europe/Helsinki',
|
||||
'Europe/Istanbul',
|
||||
'Asia/Jerusalem',
|
||||
'Europe/Helsinki',
|
||||
'Africa/Johannesburg',
|
||||
'Europe/Riga',
|
||||
'Europe/Sofia',
|
||||
'Europe/Tallinn',
|
||||
'Europe/Vilnius',
|
||||
'Asia/Baghdad',
|
||||
'Asia/Kuwait',
|
||||
'Europe/Minsk',
|
||||
'Africa/Nairobi',
|
||||
'Asia/Riyadh',
|
||||
'Europe/Volgograd',
|
||||
'Asia/Tehran',
|
||||
'Asia/Muscat',
|
||||
'Asia/Baku',
|
||||
'Europe/Moscow',
|
||||
'Asia/Muscat',
|
||||
'Europe/Moscow',
|
||||
'Asia/Tbilisi',
|
||||
'Asia/Yerevan',
|
||||
'Asia/Kabul',
|
||||
'Asia/Karachi',
|
||||
'Asia/Karachi',
|
||||
'Asia/Tashkent',
|
||||
'Asia/Calcutta',
|
||||
'Asia/Kolkata',
|
||||
'Asia/Calcutta',
|
||||
'Asia/Calcutta',
|
||||
'Asia/Calcutta',
|
||||
'Asia/Katmandu',
|
||||
'Asia/Almaty',
|
||||
'Asia/Dhaka',
|
||||
'Asia/Dhaka',
|
||||
'Asia/Yekaterinburg',
|
||||
'Asia/Rangoon',
|
||||
'Asia/Bangkok',
|
||||
'Asia/Bangkok',
|
||||
'Asia/Jakarta',
|
||||
'Asia/Novosibirsk',
|
||||
'Asia/Hong_Kong',
|
||||
'Asia/Chongqing',
|
||||
'Asia/Hong_Kong',
|
||||
'Asia/Krasnoyarsk',
|
||||
'Asia/Kuala_Lumpur',
|
||||
'Australia/Perth',
|
||||
'Asia/Singapore',
|
||||
'Asia/Taipei',
|
||||
'Asia/Ulan_Bator',
|
||||
'Asia/Urumqi',
|
||||
'Asia/Irkutsk',
|
||||
'Asia/Tokyo',
|
||||
'Asia/Tokyo',
|
||||
'Asia/Seoul',
|
||||
'Asia/Tokyo',
|
||||
'Australia/Adelaide',
|
||||
'Australia/Darwin',
|
||||
'Australia/Brisbane',
|
||||
'Australia/Canberra',
|
||||
'Pacific/Guam',
|
||||
'Australia/Hobart',
|
||||
'Australia/Melbourne',
|
||||
'Pacific/Port_Moresby',
|
||||
'Australia/Sydney',
|
||||
'Asia/Yakutsk',
|
||||
'Asia/Vladivostok',
|
||||
'Pacific/Auckland',
|
||||
'Pacific/Fiji',
|
||||
'Pacific/Kwajalein',
|
||||
'Asia/Kamchatka',
|
||||
'Asia/Magadan',
|
||||
'Pacific/Fiji',
|
||||
'Asia/Magadan',
|
||||
'Asia/Magadan',
|
||||
'Pacific/Auckland',
|
||||
'Pacific/Tongatapu'
|
||||
];
|
Loading…
Add table
Add a link
Reference in a new issue