Add tz and add at its dropdown component

This commit is contained in:
rui hildt 2020-05-15 12:05:24 +02:00
parent 8231fa62b4
commit a47ae13636
3 changed files with 411 additions and 18 deletions

View File

@ -0,0 +1,395 @@
// TODO: create a script to import timezone data when installing the backend
// And maybe enable it to update from time to time (once or twice a year?)
// import { zones } from 'tzdata';
// const luxonValidTimezones = Object.entries(zones)
// .filter(([zoneName, v]) => Array.isArray(v))
// .map(([zoneName, v]) => zoneName)
// .filter((tz) => DateTime.local().setZone(tz).isValid);
export const timezones = [
'Africa/Algiers',
'Atlantic/Cape_Verde',
'Africa/Ndjamena',
'Africa/Abidjan',
'Africa/Cairo',
'Africa/Accra',
'Africa/Bissau',
'Africa/Nairobi',
'Africa/Monrovia',
'Africa/Tripoli',
'Indian/Mauritius',
'Africa/Casablanca',
'Africa/El_Aaiun',
'Africa/Maputo',
'Africa/Windhoek',
'Africa/Lagos',
'Indian/Reunion',
'Africa/Sao_Tome',
'Indian/Mahe',
'Africa/Johannesburg',
'Africa/Khartoum',
'Africa/Juba',
'Africa/Tunis',
'Antarctica/Casey',
'Antarctica/Davis',
'Antarctica/Mawson',
'Indian/Kerguelen',
'Antarctica/DumontDUrville',
'Antarctica/Syowa',
'Antarctica/Troll',
'Antarctica/Vostok',
'Antarctica/Rothera',
'Asia/Kabul',
'Asia/Yerevan',
'Asia/Baku',
'Asia/Dhaka',
'Asia/Thimphu',
'Indian/Chagos',
'Asia/Brunei',
'Asia/Yangon',
'Asia/Shanghai',
'Asia/Urumqi',
'Asia/Hong_Kong',
'Asia/Taipei',
'Asia/Macau',
'Asia/Nicosia',
'Asia/Famagusta',
'Asia/Tbilisi',
'Asia/Dili',
'Asia/Kolkata',
'Asia/Jakarta',
'Asia/Pontianak',
'Asia/Makassar',
'Asia/Jayapura',
'Asia/Tehran',
'Asia/Baghdad',
'Asia/Jerusalem',
'Asia/Tokyo',
'Asia/Amman',
'Asia/Almaty',
'Asia/Qyzylorda',
'Asia/Qostanay',
'Asia/Aqtobe',
'Asia/Aqtau',
'Asia/Atyrau',
'Asia/Oral',
'Asia/Bishkek',
'Asia/Seoul',
'Asia/Pyongyang',
'Asia/Beirut',
'Asia/Kuala_Lumpur',
'Asia/Kuching',
'Indian/Maldives',
'Asia/Hovd',
'Asia/Ulaanbaatar',
'Asia/Choibalsan',
'Asia/Kathmandu',
'Asia/Karachi',
'Asia/Gaza',
'Asia/Hebron',
'Asia/Manila',
'Asia/Qatar',
'Asia/Riyadh',
'Asia/Singapore',
'Asia/Colombo',
'Asia/Damascus',
'Asia/Dushanbe',
'Asia/Bangkok',
'Asia/Ashgabat',
'Asia/Dubai',
'Asia/Samarkand',
'Asia/Tashkent',
'Asia/Ho_Chi_Minh',
'Australia/Darwin',
'Australia/Perth',
'Australia/Eucla',
'Australia/Brisbane',
'Australia/Lindeman',
'Australia/Adelaide',
'Australia/Hobart',
'Australia/Currie',
'Australia/Melbourne',
'Australia/Sydney',
'Australia/Broken_Hill',
'Australia/Lord_Howe',
'Antarctica/Macquarie',
'Indian/Christmas',
'Indian/Cocos',
'Pacific/Fiji',
'Pacific/Gambier',
'Pacific/Marquesas',
'Pacific/Tahiti',
'Pacific/Guam',
'Pacific/Tarawa',
'Pacific/Enderbury',
'Pacific/Kiritimati',
'Pacific/Majuro',
'Pacific/Kwajalein',
'Pacific/Chuuk',
'Pacific/Pohnpei',
'Pacific/Kosrae',
'Pacific/Nauru',
'Pacific/Noumea',
'Pacific/Auckland',
'Pacific/Chatham',
'Pacific/Rarotonga',
'Pacific/Niue',
'Pacific/Norfolk',
'Pacific/Palau',
'Pacific/Port_Moresby',
'Pacific/Bougainville',
'Pacific/Pitcairn',
'Pacific/Pago_Pago',
'Pacific/Apia',
'Pacific/Guadalcanal',
'Pacific/Fakaofo',
'Pacific/Tongatapu',
'Pacific/Funafuti',
'Pacific/Wake',
'Pacific/Efate',
'Pacific/Wallis',
'Etc/GMT',
'Etc/UTC',
'Etc/GMT-14',
'Etc/GMT-13',
'Etc/GMT-12',
'Etc/GMT-11',
'Etc/GMT-10',
'Etc/GMT-9',
'Etc/GMT-8',
'Etc/GMT-7',
'Etc/GMT-6',
'Etc/GMT-5',
'Etc/GMT-4',
'Etc/GMT-3',
'Etc/GMT-2',
'Etc/GMT-1',
'Etc/GMT+1',
'Etc/GMT+2',
'Etc/GMT+3',
'Etc/GMT+4',
'Etc/GMT+5',
'Etc/GMT+6',
'Etc/GMT+7',
'Etc/GMT+8',
'Etc/GMT+9',
'Etc/GMT+10',
'Etc/GMT+11',
'Etc/GMT+12',
'Europe/London',
'Europe/Dublin',
'WET',
'CET',
'MET',
'EET',
'Europe/Tirane',
'Europe/Andorra',
'Europe/Vienna',
'Europe/Minsk',
'Europe/Brussels',
'Europe/Sofia',
'Europe/Prague',
'Europe/Copenhagen',
'Atlantic/Faroe',
'America/Danmarkshavn',
'America/Scoresbysund',
'America/Nuuk',
'America/Thule',
'Europe/Tallinn',
'Europe/Helsinki',
'Europe/Paris',
'Europe/Berlin',
'Europe/Gibraltar',
'Europe/Athens',
'Europe/Budapest',
'Atlantic/Reykjavik',
'Europe/Rome',
'Europe/Riga',
'Europe/Vilnius',
'Europe/Luxembourg',
'Europe/Malta',
'Europe/Chisinau',
'Europe/Monaco',
'Europe/Amsterdam',
'Europe/Oslo',
'Europe/Warsaw',
'Europe/Lisbon',
'Atlantic/Azores',
'Atlantic/Madeira',
'Europe/Bucharest',
'Europe/Kaliningrad',
'Europe/Moscow',
'Europe/Simferopol',
'Europe/Astrakhan',
'Europe/Volgograd',
'Europe/Saratov',
'Europe/Kirov',
'Europe/Samara',
'Europe/Ulyanovsk',
'Asia/Yekaterinburg',
'Asia/Omsk',
'Asia/Barnaul',
'Asia/Novosibirsk',
'Asia/Tomsk',
'Asia/Novokuznetsk',
'Asia/Krasnoyarsk',
'Asia/Irkutsk',
'Asia/Chita',
'Asia/Yakutsk',
'Asia/Vladivostok',
'Asia/Khandyga',
'Asia/Sakhalin',
'Asia/Magadan',
'Asia/Srednekolymsk',
'Asia/Ust-Nera',
'Asia/Kamchatka',
'Asia/Anadyr',
'Europe/Belgrade',
'Europe/Madrid',
'Africa/Ceuta',
'Atlantic/Canary',
'Europe/Stockholm',
'Europe/Zurich',
'Europe/Istanbul',
'Europe/Kiev',
'Europe/Uzhgorod',
'Europe/Zaporozhye',
'Factory',
'EST',
'MST',
'HST',
'America/New_York',
'America/Chicago',
'America/North_Dakota/Center',
'America/North_Dakota/New_Salem',
'America/North_Dakota/Beulah',
'America/Denver',
'America/Los_Angeles',
'America/Juneau',
'America/Sitka',
'America/Metlakatla',
'America/Yakutat',
'America/Anchorage',
'America/Nome',
'America/Adak',
'Pacific/Honolulu',
'America/Phoenix',
'America/Boise',
'America/Indiana/Indianapolis',
'America/Indiana/Marengo',
'America/Indiana/Vincennes',
'America/Indiana/Tell_City',
'America/Indiana/Petersburg',
'America/Indiana/Knox',
'America/Indiana/Winamac',
'America/Indiana/Vevay',
'America/Kentucky/Louisville',
'America/Kentucky/Monticello',
'America/Detroit',
'America/Menominee',
'America/St_Johns',
'America/Goose_Bay',
'America/Halifax',
'America/Glace_Bay',
'America/Moncton',
'America/Blanc-Sablon',
'America/Toronto',
'America/Thunder_Bay',
'America/Nipigon',
'America/Rainy_River',
'America/Atikokan',
'America/Winnipeg',
'America/Regina',
'America/Swift_Current',
'America/Edmonton',
'America/Vancouver',
'America/Dawson_Creek',
'America/Fort_Nelson',
'America/Creston',
'America/Pangnirtung',
'America/Iqaluit',
'America/Resolute',
'America/Rankin_Inlet',
'America/Cambridge_Bay',
'America/Yellowknife',
'America/Inuvik',
'America/Whitehorse',
'America/Dawson',
'America/Cancun',
'America/Merida',
'America/Matamoros',
'America/Monterrey',
'America/Mexico_City',
'America/Ojinaga',
'America/Chihuahua',
'America/Hermosillo',
'America/Mazatlan',
'America/Bahia_Banderas',
'America/Tijuana',
'America/Nassau',
'America/Barbados',
'America/Belize',
'Atlantic/Bermuda',
'America/Costa_Rica',
'America/Havana',
'America/Santo_Domingo',
'America/El_Salvador',
'America/Guatemala',
'America/Port-au-Prince',
'America/Tegucigalpa',
'America/Jamaica',
'America/Martinique',
'America/Managua',
'America/Panama',
'America/Puerto_Rico',
'America/Miquelon',
'America/Grand_Turk',
'America/Argentina/Buenos_Aires',
'America/Argentina/Cordoba',
'America/Argentina/Salta',
'America/Argentina/Tucuman',
'America/Argentina/La_Rioja',
'America/Argentina/San_Juan',
'America/Argentina/Jujuy',
'America/Argentina/Catamarca',
'America/Argentina/Mendoza',
'America/Argentina/San_Luis',
'America/Argentina/Rio_Gallegos',
'America/Argentina/Ushuaia',
'America/La_Paz',
'America/Noronha',
'America/Belem',
'America/Santarem',
'America/Fortaleza',
'America/Recife',
'America/Araguaina',
'America/Maceio',
'America/Bahia',
'America/Sao_Paulo',
'America/Campo_Grande',
'America/Cuiaba',
'America/Porto_Velho',
'America/Boa_Vista',
'America/Manaus',
'America/Eirunepe',
'America/Rio_Branco',
'America/Santiago',
'America/Punta_Arenas',
'Pacific/Easter',
'Antarctica/Palmer',
'America/Bogota',
'America/Curacao',
'America/Guayaquil',
'Pacific/Galapagos',
'Atlantic/Stanley',
'America/Cayenne',
'America/Guyana',
'America/Asuncion',
'America/Lima',
'Atlantic/South_Georgia',
'America/Paramaribo',
'America/Port_of_Spain',
'America/Montevideo',
'America/Caracas',
];

View File

@ -0,0 +1,13 @@
import React from 'react';
import { timezones } from './../../assets/data/timezones';
import { Dropdown } from 'rsuite';
export default function Tzdropdown() {
return (
<Dropdown title='Timezone'>
{timezones.map((tz) => (
<Dropdown.Item key={tz}>{tz}</Dropdown.Item>
))}
</Dropdown>
);
}

View File

@ -8,9 +8,10 @@ import {
FormControl,
HelpBlock,
Button,
Dropdown,
} from 'rsuite';
import TzDropdown from './../components/General/TzDropdown';
const boxStyle = {
margin: '50px 10px',
};
@ -35,23 +36,7 @@ export default function Register() {
placeholder='email'
/>
</FormGroup>
<FormGroup>
<Dropdown title='Timezone'>
<Dropdown.Item>
Australian Central Time
</Dropdown.Item>
<Dropdown.Item>
Australian Eastern Time
</Dropdown.Item>
<Dropdown.Item>
Alaska Standard Time
</Dropdown.Item>
<Dropdown.Item>
Bangladesh Standard Time{' '}
</Dropdown.Item>
<Dropdown.Item>...</Dropdown.Item>
</Dropdown>
</FormGroup>
<FormGroup><TzDropdown /></FormGroup>
<FormGroup>
<FormControl
name='password'