Skip to main content

Fill timezone from phone

This optional Code block fills the contact's Timezone column from their phone number before enrollment. It keeps any timezone that is already set.

The board needs exactly one Phone column and one World Clock column.

Add the block​

In the enrollment automation, add a Code block between the trigger and Enroll contact to harmony:

  1. Use Rename inputs to add an input named item_id, mapped to TriggerItem ID.
  2. Declare one output: timezone, type String.
  3. Paste this code:
Fill timezone from phone
import re

# Country zones: IANA zone.tab, checked 2026-10-07. Shared calling codes
# are included only when all their regions have one timezone in total.
SINGLE_ZONE_CODES = {
"20": "Africa/Cairo",
"27": "Africa/Johannesburg",
"30": "Europe/Athens",
"31": "Europe/Amsterdam",
"32": "Europe/Brussels",
"33": "Europe/Paris",
"36": "Europe/Budapest",
"40": "Europe/Bucharest",
"41": "Europe/Zurich",
"43": "Europe/Vienna",
"45": "Europe/Copenhagen",
"46": "Europe/Stockholm",
"48": "Europe/Warsaw",
"51": "America/Lima",
"53": "America/Havana",
"57": "America/Bogota",
"58": "America/Caracas",
"63": "Asia/Manila",
"65": "Asia/Singapore",
"66": "Asia/Bangkok",
"81": "Asia/Tokyo",
"82": "Asia/Seoul",
"84": "Asia/Ho_Chi_Minh",
"90": "Europe/Istanbul",
"91": "Asia/Kolkata",
"92": "Asia/Karachi",
"93": "Asia/Kabul",
"94": "Asia/Colombo",
"95": "Asia/Yangon",
"98": "Asia/Tehran",
"211": "Africa/Juba",
"213": "Africa/Algiers",
"216": "Africa/Tunis",
"218": "Africa/Tripoli",
"220": "Africa/Banjul",
"221": "Africa/Dakar",
"222": "Africa/Nouakchott",
"223": "Africa/Bamako",
"224": "Africa/Conakry",
"225": "Africa/Abidjan",
"226": "Africa/Ouagadougou",
"227": "Africa/Niamey",
"228": "Africa/Lome",
"229": "Africa/Porto-Novo",
"230": "Indian/Mauritius",
"231": "Africa/Monrovia",
"232": "Africa/Freetown",
"233": "Africa/Accra",
"234": "Africa/Lagos",
"235": "Africa/Ndjamena",
"236": "Africa/Bangui",
"237": "Africa/Douala",
"238": "Atlantic/Cape_Verde",
"239": "Africa/Sao_Tome",
"240": "Africa/Malabo",
"241": "Africa/Libreville",
"242": "Africa/Brazzaville",
"244": "Africa/Luanda",
"245": "Africa/Bissau",
"246": "Indian/Chagos",
"248": "Indian/Mahe",
"249": "Africa/Khartoum",
"250": "Africa/Kigali",
"251": "Africa/Addis_Ababa",
"252": "Africa/Mogadishu",
"253": "Africa/Djibouti",
"254": "Africa/Nairobi",
"255": "Africa/Dar_es_Salaam",
"256": "Africa/Kampala",
"257": "Africa/Bujumbura",
"258": "Africa/Maputo",
"260": "Africa/Lusaka",
"261": "Indian/Antananarivo",
"263": "Africa/Harare",
"264": "Africa/Windhoek",
"265": "Africa/Blantyre",
"266": "Africa/Maseru",
"267": "Africa/Gaborone",
"268": "Africa/Mbabane",
"269": "Indian/Comoro",
"291": "Africa/Asmara",
"297": "America/Aruba",
"298": "Atlantic/Faroe",
"350": "Europe/Gibraltar",
"352": "Europe/Luxembourg",
"353": "Europe/Dublin",
"354": "Atlantic/Reykjavik",
"355": "Europe/Tirane",
"356": "Europe/Malta",
"359": "Europe/Sofia",
"370": "Europe/Vilnius",
"371": "Europe/Riga",
"372": "Europe/Tallinn",
"373": "Europe/Chisinau",
"374": "Asia/Yerevan",
"375": "Europe/Minsk",
"376": "Europe/Andorra",
"377": "Europe/Monaco",
"378": "Europe/San_Marino",
"381": "Europe/Belgrade",
"382": "Europe/Podgorica",
"385": "Europe/Zagreb",
"386": "Europe/Ljubljana",
"387": "Europe/Sarajevo",
"389": "Europe/Skopje",
"420": "Europe/Prague",
"421": "Europe/Bratislava",
"423": "Europe/Vaduz",
"500": "Atlantic/Stanley",
"501": "America/Belize",
"502": "America/Guatemala",
"503": "America/El_Salvador",
"504": "America/Tegucigalpa",
"505": "America/Managua",
"506": "America/Costa_Rica",
"507": "America/Panama",
"508": "America/Miquelon",
"509": "America/Port-au-Prince",
"591": "America/La_Paz",
"592": "America/Guyana",
"594": "America/Cayenne",
"595": "America/Asuncion",
"596": "America/Martinique",
"597": "America/Paramaribo",
"598": "America/Montevideo",
"670": "Asia/Dili",
"672": "Pacific/Norfolk",
"673": "Asia/Brunei",
"674": "Pacific/Nauru",
"676": "Pacific/Tongatapu",
"677": "Pacific/Guadalcanal",
"678": "Pacific/Efate",
"679": "Pacific/Fiji",
"680": "Pacific/Palau",
"681": "Pacific/Wallis",
"682": "Pacific/Rarotonga",
"683": "Pacific/Niue",
"685": "Pacific/Apia",
"687": "Pacific/Noumea",
"688": "Pacific/Funafuti",
"690": "Pacific/Fakaofo",
"850": "Asia/Pyongyang",
"852": "Asia/Hong_Kong",
"853": "Asia/Macau",
"855": "Asia/Phnom_Penh",
"856": "Asia/Vientiane",
"880": "Asia/Dhaka",
"886": "Asia/Taipei",
"960": "Indian/Maldives",
"961": "Asia/Beirut",
"962": "Asia/Amman",
"963": "Asia/Damascus",
"964": "Asia/Baghdad",
"965": "Asia/Kuwait",
"966": "Asia/Riyadh",
"967": "Asia/Aden",
"968": "Asia/Muscat",
"971": "Asia/Dubai",
"972": "Asia/Jerusalem",
"973": "Asia/Bahrain",
"974": "Asia/Qatar",
"975": "Asia/Thimphu",
"977": "Asia/Kathmandu",
"992": "Asia/Dushanbe",
"993": "Asia/Ashgabat",
"994": "Asia/Baku",
"995": "Asia/Tbilisi",
"996": "Asia/Bishkek"
}

# NANPA data: google/libphonenumber resources/timezones/map_data.txt,
# commit d347e5d04397c99fe018636eac2f363a27af71c2, grouped by timezone list.
# Copyright (C) 2012 The Libphonenumber Authors

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Generated from:
# Internal statistics data (2018-06-12).
NANPA_DATA = """America/Adak&America/Anchorage&America/Anguilla&America/Antigua&America/Barbados&America/Boise&America/Cayman&America/Chicago&America/Denver&America/Dominica&America/Edmonton&America/Fort_Nelson&America/Grand_Turk&America/Grenada&America/Halifax&America/Jamaica&America/Juneau&America/Los_Angeles&America/Lower_Princes&America/Montserrat&America/Nassau&America/New_York&America/North_Dakota/Center&America/Phoenix&America/Port_of_Spain&America/Puerto_Rico&America/Regina&America/Santo_Domingo&America/St_Johns&America/St_Kitts&America/St_Lucia&America/St_Thomas&America/St_Vincent&America/Toronto&America/Tortola&America/Vancouver&America/Winnipeg&Atlantic/Bermuda&Pacific/Guam&Pacific/Honolulu&Pacific/Pago_Pago&Pacific/Saipan|1
America/New_York|1201 1202 1203 1207 1212 1215 1216 1219 1220 1223 1227 1229 1231 1234 1239 1240 1248 1252 1260 1267 1269 1270 1272 1276 1283 1301 1302 1304 1305 1313 1315 1317 1321 1324 1326 1329 1330 1332 1336 1339 1347 1351 1352 1363 1364 1380 1386 1401 1404 1407 1410 1412 1413 1419 1423202 1423209 1423217 1423218 1423224 142323 1423245 1423246 1423247 1423253 1423254 1423257 1423262 1423263 1423265 1423266 1423267 1423272 1423278 1423279 1423282 1423283 1423286 1423288 1423296 1423305 1423307 1423317 1423318 1423323 1423328 142333 1423343 1423344 1423345 1423346 1423349 1423357 1423365 1423378 1423391 1423392 1423396 1423402 1423421 1423422 1423424 1423425 1423431 1423434 1423439 1423442 1423443 1423451 1423453 1423467 1423468 142347 1423485 1423487 142349 1423503 1423507 1423508 1423510 1423521 1423525 1423531 1423538 1423542 1423543 1423547 1423553 1423559 1423562 1423566 1423569 1423570 1423573 1423578 1423581 1423585 1423586 1423587 1423595 1423602 1423610 1423613 1423614 142362 1423631 1423634 1423636 1423638 1423639 1423643 1423648 1423652 1423663 1423664 1423667 1423697 1423698 1423702 1423708 1423710 1423722 1423725 1423727 1423728 1423733 1423735 1423743 1423744 1423745 1423746 1423752 1423753 1423756 1423757 1423760 1423764 1423765 1423768 1423772 1423775 1423778 1423784 1423787 1423788 1423790 1423794 1423798 1423800 1423802 1423803 1423805 1423821 1423822 1423825 1423826 1423839 1423842 1423843 1423844 1423847 1423854 1423855 1423857 1423867 1423869 1423870 1423875 1423876 1423877 1423878 1423884 1423886 1423892 1423893 1423894 1423899 1423907 1423913 1423915 1423921 1423926 1423928 1423929 1423933 1423952 1423954 1423968 1423975 1423979 1423989 1434 1440 1443 1445 1448 1463 1470 1472 1475 1478 1484 1502 1508 1513 1516 1517 1518 1540 1551 1561 1567 1570 1571 1574 1582 1585 1586 1603 1606 1607 1609 1610 1614 1616 1617 1631 1640 1645 1646 1656 1667 1678 1680 1681 1686 1703 1704 1706 1716 1717 1718 1724 1727 1728 1732 1734 1740 1743 1754 1757 1762 1765 1770 1771 1772 1774 1781 1786 1802 1803 1804 1810 1812 1813 1814 1821 1826 1828 1835 1838 1839 1843 1845 1848 1850 1854 1856 1857 1859 1860 1862 1863 1864 1865 1878 1904 1906 1908 1910 1912 1914 1917 1919 1929 1930 1934 1937 1941 1943 1947 1948 1954 1959 1973 1978 1980 1984 1989
America/Winnipeg|1204 1431 1474 1584 1807223 1807274 1807467 1807468 1807482 1807548 1807727 1807737 1807934 1867645
America/Chicago|1205 1210 1214 1217 1218 1219226 1219227 1219242 1219261 1219263 1219285 1219286 1219299 1219322 1219324 1219325 1219326 1219345 1219362 1219365 1219369 1219374 1219392 1219393 1219395 1219397 1219398 1219427 1219440 1219462 1219464 1219465 1219472 1219473 1219474 1219476 1219477 1219513 1219531 1219548 1219558 1219595 1219659 1219661 1219662 1219663 1219690 1219696 1219707 1219728 1219733 1219736 1219738 1219755 1219756 1219757 1219759 1219762 1219763 1219764 1219766 1219769 1219778 1219779 1219785 1219787 1219791 1219803 1219836 1219838 1219844 1219845 1219852 1219853 1219864 1219865 1219866 1219872 1219873 1219874 1219878 1219879 121988 121992 121993 121994 1219956 1219962 1219963 1219972 1219977 1219980 1219983 1219987 1219989 1219996 1224 1225 1228 1235 1251 1254 1256 1262 1270202 1270230 1270236 1270237 1270240 1270242 1270247 1270251 1270259 1270265 1270273 1270274 1270282 1270298 1270333 1270335 1270338 1270343 1270354 1270362 1270365 1270384 1270388 1270389 1270393 1270395 1270415 1270432 1270439 1270441 1270442 1270443 1270444 1270462 1270472 1270483 1270487 1270495 1270522 1270524 1270526 1270527 1270528 1270534 1270535 1270538 1270542 1270547 1270554 1270563 1270575 1270586 1270597 1270598 1270618 1270622 1270628 1270629 1270639 1270640 1270646 1270651 1270653 1270659 1270665 1270667 1270678 127068 1270691 1270707 1270725 1270726 1270745 1270746 1270753 1270754 1270755 1270756 1270759 1270761 1270762 1270767 1270773 1270780 1270781 1270782 1270783 1270786 1270792 1270793 1270796 1270797 1270798 1270821 1270824 1270825 1270826 1270827 1270830 1270831 1270842 1270843 1270846 1270852 1270864 1270866 1270879 1270881 1270885 1270886 1270887 1270889 1270898 1270901 1270904 1270924 1270926 1270927 1270928 1270929 1270932 1270965 1270988 1274 1281 1308 1309 1312 1314 1316 1318 1319 1320 1325 1327 1331 1334 1337 1346 1353 1361 1402 1405 1409 1414 1417 1423 1430 1432 1447 1464 1469 1479 1501 1504 1507 1512 1515 1531 1534 1539 1557 1563 1572 1573 1574772 1574896 1580 1601 1605201 1605217 1605221 1605224 1605225 1605226 1605229 1605232 1605234 1605256 1605260 1605261 1605262 1605271 1605274 1605275 1605284 1605297 1605310 1605312 1605321 1605322 1605323 1605328 160533 1605345 160535 160536 1605370 1605371 1605373 1605376 1605384 1605387 1605397 1605425 1605426 1605428 1605432 1605448 1605472 1605487 1605498 1605528 1605532 1605539 1605543 1605553 1605582 1605589 1605594 1605598 1605610 1605622 1605624 1605626 1605627 1605647 1605649 1605665 1605668 1605669 1605677 160569 1605724 1605725 1605728 1605734 1605743 1605747 1605753 1605759 1605763 1605765 1605772 1605773 1605775 1605778 1605796 1605835 1605842 1605845 1605852 1605853 1605854 1605856 1605874 1605878 1605881 1605882 1605886 1605925 1605928 1605929 1605940 1605941 1605945 1605946 1605951 1605977 1605983 1605987 1605988 1605990 1605995 1605996 1605997 1606387 1608 1612 1615 1618 1620 1629 1630 1636 1641 1651 1659 1660 1662 1682 1689 1701200 1701205 1701212 1701214 170122 170123 1701241 1701242 170125 1701261 1701265 1701271 1701277 1701280 1701281 1701282 1701284 1701288 1701293 1701297 1701298 1701306 1701323 1701324 1701328 1701343 1701347 1701349 1701352 1701355 1701356 1701361 1701364 1701365 1701367 1701371 1701373 1701385 1701388 1701390 1701391 1701400 1701425 1701426 1701428 1701437 1701444 1701446 1701448 1701452 1701454 1701462 1701463 1701471 1701476 1701477 1701478 1701492 1701499 1701527 1701530 1701532 1701540 1701549 1701566 1701572 1701577 1701595 1701609 1701627 1701628 1701636 1701642 1701652 1701662 1701663 1701664 1701667 1701683 1701724 1701730 1701738 1701739 1701742 1701746 1701748 1701751 1701754 1701756 1701757 1701766 1701772 1701774 1701775 1701776 1701777 1701780 1701786 1701787 1701788 1701793 1701795 1701797 1701799 1701833 1701837 1701838 1701839 1701842 1701843 1701845 1701852 1701854 1701857 1701858 1701866 1701873 1701883 1701893 1701947 1701952 1701965 1701968 1708 1712 1713 1715 1726 1730 1731 1737 1763 1769 1773 1779 1785 1806 1812385 1812386 1812401 1812402 181242 1812435 1812437 1812450 1812464 181247 1812485 1812490 1812491 1812547 1812618 1812649 1812682 1812749 1812753 1812768 1812838 1812842 1812853 1812858 1812867 1812874 1812897 1812925 1812937 1812962 1812963 1812985 1815 1816 1817 1830 1832 1847 1850200 1850206 1850208 1850213 1850215 1850217 1850218 1850221 1850225 1850226 1850227 1850229 185023 1850240 1850243 1850244 1850248 1850249 1850250 1850256 1850258 1850259 1850261 1850263 1850265 1850267 1850269 1850271 1850276 1850279 1850291 1850292 1850301 1850306 1850314 1850315 1850319 1850324 1850327 1850332 1850341 1850361 1850362 1850368 1850376 1850377 1850380 1850384 1850387 1850393 1850396 1850398 1850416 1850417 1850420 1850423 1850424 1850429 185043 1850444 185045 1850460 1850462 1850466 1850469 185047 1850481 1850482 1850484 1850492 1850494 1850496 1850497 1850499 1850501 1850502 1850505 1850516 1850522 1850525 1850526 1850527 1850529 1850535 1850537 1850543 1850547 1850572 1850581 1850585 1850586 1850587 1850588 1850592 1850593 1850595 1850596 1850607 1850622 1850623 1850624 1850626 1850637 1850638 1850639 1850640 1850650 1850651 1850654 1850659 1850664 1850674 1850675 1850677 1850678 185068 1850696 1850699 1850708 1850712 1850722 1850723 1850729 1850733 1850747 1850748 1850763 1850769 1850784 1850785 1850791 1850796 1850797 1850814 1850819 1850830 1850832 1850833 1850835 1850837 1850855 1850857 185086 1850871 1850872 1850874 1850883 1850890 1850892 1850897 1850898 1850912 1850913 1850914 1850916 1850932 1850934 1850936 1850937 1850939 1850941 1850944 1850951 1850968 1850969 1850972 1850974 1850981 1850982 1850983 1850994 1850995 1870 1872 1901 1903 1906265 1906563 1906663 1906753 1906774 1906776 1906779 1906828 1906863 1906864 1906875 1906932 1913 1918 1920 1931 1936 1938 1940 1945 1952 1956 1972 1975 1979 1985
America/Los_Angeles|1206 1208215 1208245 1208255 1208262 1208263 1208265 1208267 1208290 1208292 1208304 1208305 1208437 1208443 1208446 1208448 1208457 1208476 1208556 1208596 1208610 1208623 1208625 1208640 1208651 1208659 120866 1208676 1208682 1208683 1208686 1208687 1208691 1208699 1208704 1208743 1208746 1208755 1208762 1208765 1208769 1208772 1208773 1208777 1208783 1208784 1208791 1208798 1208799 1208818 1208819 1208835 1208843 1208875 1208882 1208883 1208885 1208926 1208935 1208946 1208962 1208964 1208983 1209 1213 1253 1279 13102 13103 13104 13105 13106 13107 13108 13109 1323 1341 1350 1360 1369 1408 1415 1424 1425 1442 1458 1503 1509 1510 1530 1541 1559 1562 1564 1619 1626 1628 1650 1657 1661 1669 1702 1707 1714 1725 1738 1747 1760 1775200 1775230 1775232 1775233 1775237 1775240 1775246 1775250 1775265 1775267 1775273 1775284 1775287 1775289 1775298 1775313 177532 177533 1775345 1775348 177535 1775360 1775376 1775384 1775391 1775392 1775423 1775424 1775425 1775428 1775432 1775445 1775450 1775453 1775461 1775463 1775470 1775473 1775482 1775525 1775537 1775544 1775575 1775577 1775586 1775588 1775622 1775623 1775624 1775625 1775626 1775635 1775636 1775657 1775673 1775674 1775677 1775684 1775686 1775687 1775688 1775689 1775720 1775721 1775722 1775726 1775727 1775737 1775738 1775742 1775746 1775747 1775750 1775751 1775752 1775753 1775762 1775770 1775771 1775772 1775777 1775778 1775782 1775783 1775784 1775786 1775787 1775800 177582 1775830 1775831 1775832 1775833 1775835 1775841 1775843 1775847 1775849 177585 1775867 1775870 177588 1775945 1775971 1775972 1775982 1805 1818 1820 1831 1840 1858 1909 1916 1925 1949 1951 1971
America/Boise&America/Los_Angeles|12082 120830 120831 1208320 1208325 1208328 1208329 1208330 1208332 1208335 1208341 1208347 1208348 1208349 1208355 1208358 1208361 1208363 1208364 1208368 1208369 1208370 1208372 1208374 1208379 1208380 1208386 1208387 1208393 1208394 1208395 1208396 1208399 1208400 1208404 1208405 1208406 1208408 120841 1208421 1208427 1208428 1208430 1208432 1208434 1208435 1208439 1208441 1208444 1208445 1208447 1208449 1208450 1208451 1208456 1208458 1208460 1208464 1208469 1208470 1208471 1208474 1208477 1208479 120848 120849 12085 12086 1208700 1208701 1208702 1208707 1208708 120871 1208721 1208723 1208728 1208729 1208730 1208738 1208739 120874 120875 1208760 1208763 1208764 1208767 1208768 120877 1208780 1208781 1208786 120879 120880 120881 120882 120883 120884 1208851 1208856 1208857 1208858 1208862 1208864 1208865 1208868 1208872 1208873 1208874 1208876 1208877 1208889 1208892 1208893 1208894 1208897 12089 1775 1986
America/Denver|1208201 1208221 1208226 1208227 1208228 120823 1208241 1208242 1208249 1208250 1208251 1208253 1208254 1208258 1208278 120828 1208297 12083 1208401 1208402 1208403 1208407 1208409 1208412 1208414 1208419 120842 1208431 1208433 1208436 1208438 1208440 1208442 1208452 1208453 1208454 1208455 1208459 120846 1208472 1208473 1208475 1208478 1208484 1208489 1208495 1208505 1208514 1208515 120852 1208535 1208536 1208538 1208539 1208542 1208543 1208546 1208547 1208549 1208552 1208557 1208558 1208559 1208562 1208569 1208570 1208571 1208573 1208577 1208578 1208585 1208587 1208588 1208589 1208595 1208602 1208608 1208622 1208624 1208628 1208629 1208631 1208634 1208637 1208639 1208642 1208652 1208656 1208658 1208672 1208677 1208678 1208681 1208684 1208695 1208697 1208703 1208705 1208706 1208709 1208713 1208716 120872 120873 1208745 1208756 1208761 1208766 1208782 1208785 1208787 1208788 1208789 1208794 1208814 1208830 1208837 1208841 1208846 1208847 120885 120886 1208870 1208871 1208878 1208879 120888 120889 1208901 1208904 1208906 1208908 1208917 1208918 1208921 1208922 1208928 1208934 1208936 1208938 1208939 1208941 1208944 1208947 1208949 1208954 1208955 1208989 1208991 1208994 1208995 1208996 1303 1307 1308235 130824 1308254 1308262 1308282 1308284 1308327 1308352 1308394 1308423 1308432 1308436 1308546 1308623 1308630 1308632 1308633 1308635 1308665 1308762 1308772 1308874 1308882 1385 1406 1435 1505 1541372 1541473 1541881 1541889 1575 1605209 1605223 1605255 1605279 1605341 1605342 1605343 1605347 1605348 1605355 1605374 1605381 1605388 1605390 1605391 1605393 1605394 1605399 1605415 1605430 1605431 1605455 1605484 1605574 1605578 1605584 1605593 1605641 1605642 1605644 1605666 1605673 1605685 1605716 1605717 1605718 1605719 1605720 1605721 1605722 1605723 1605745 1605755 1605787 1605791 1605823 1605837 1605859 1605867 1605892 1605923 1605964 1620376 1620384 1701225 1701227 1701290 1701456 1701483 1701523 1701567 1701575 1701584 1701623 1701764 1701824 1701872 1719 1720 1748 1775664 1785852 1785890 1785899 1801 1915 1970 1983
America/Toronto|1226 1249 1263 1273 1289 1343 1354 1365 1367 1382 1416 1418 1437 1438 1450 1468 1514 1519 1548 1579 1581 1613 1647 1683 1705 1742 1753 1807 1819 1867979 1873 1905 1942
America/Vancouver|1236 1250 1257 1604 1672 1778 1867334 1867393 1867456 1867536 1867633 1867667 1867668 1867993
America/Nassau|1242
America/Barbados|1246
America/Edmonton|1250242 1250261 1250262 1250263 1250341 1250342 1250344 1250347 1250417 1250423 1250425 1250426 1250427 1250428 1250489 1250719 1250774 1250782 1250784 1250785 1250787 1250788 1368 1403 1587 1780 1825 1867587 1867669 1867695 1867777 1867872 1867873 1867874 1867920 1867983
America/Anguilla|1264
America/Antigua|1268
America/Tortola|1284
America/Regina|1306 1639
America/St_Thomas|1340
America/Cayman|1345
America/Halifax|1418937 1418986 1428 1506 1709282 1709896 1709944 1782 1902
Atlantic/Bermuda|1441
America/Grenada|1473
America/Phoenix|1480 1520 1602 1623 1928
America/Denver&America/North_Dakota/Center|1605 1701
America/Grand_Turk|1649
America/Jamaica|1658 1876
America/Montserrat|1664
Pacific/Saipan|1670
Pacific/Guam|1671
Pacific/Pago_Pago|1684
America/Puerto_Rico&America/St_Johns|1709 1879
America/St_Johns|1709227 1709229 1709237 1709256 1709257 1709279 1709364 1709368 1709437 1709454 1709458 1709466 1709468 1709489 1709533 1709535 1709576 1709579 1709596 1709634 1709635 1709637 1709639 1709643 1709651 1709673 1709682 1709685 1709687 1709695 1709722 1709726 1709729 1709738 1709739 1709745 1709747 1709753 1709754 1709757 1709758 1709759 1709782 1709786 1709832 1709834 1709884 1709895
America/Lower_Princes|1721
America/St_Lucia|1758
America/Dominica|1767
America/St_Vincent|1784
America/Puerto_Rico|1787 1939
Pacific/Honolulu|1808 1907581
America/Santo_Domingo|1809 1829 1849
America/Fort_Nelson|1867
America/Port_of_Spain|1868
America/St_Kitts|1869
America/Adak&America/Anchorage|1907
America/Juneau|1907209 1907212 190722 1907230 1907232 1907235 190724 1907250 1907252 1907257 1907258 1907260 1907262 1907264 1907269 190727 1907283 1907299 1907301 1907306 1907317 190733 1907343 1907344 1907345 1907346 1907349 1907350 1907351 1907352 1907357 1907360 1907373 1907374 1907375 1907376 1907378 1907388 1907424 1907442 1907443 190745 1907463 1907465 1907474 1907479 1907486 1907487 1907488 1907490 1907495 1907522 1907523 1907543 1907561 1907562 1907563 1907567 1907569 1907580 1907586 1907622 1907631 1907644 1907646 1907677 1907683 1907688 1907694 1907696 1907714 1907723 1907727 1907729 1907733 1907742 1907743 1907745 1907746 1907747 1907766 1907770 1907772 1907776 1907780 1907783 1907786 1907789 1907790 1907822 1907826 1907830 1907835 1907841 1907842 1907852 1907868 1907874 1907883 1907892 1907895 1907929 1907966 1907983
America/Denver&America/Phoenix|1928283 1928672 1928673 1928674 1928677 1928686 1928697 1928698 1928724 1928725 1928728 1928729 1928755 1928781 1928787 1928871"""
NANPA_ZONES = {}
for row in NANPA_DATA.splitlines():
zones, prefixes = row.split("|", 1)
for prefix in prefixes.split():
NANPA_ZONES[prefix] = zones.split("&")


COUNTRY_CALLING_CODES = dict(entry.split(":") for entry in "AC:247 AD:376 AE:971 AF:93 AG:1 AI:1 AL:355 AM:374 AO:244 AR:54 AS:1 AT:43 AU:61 AW:297 AX:358 AZ:994 BA:387 BB:1 BD:880 BE:32 BF:226 BG:359 BH:973 BI:257 BJ:229 BL:590 BM:1 BN:673 BO:591 BQ:599 BR:55 BS:1 BT:975 BW:267 BY:375 BZ:501 CA:1 CC:61 CD:243 CF:236 CG:242 CH:41 CI:225 CK:682 CL:56 CM:237 CN:86 CO:57 CR:506 CU:53 CV:238 CW:599 CX:61 CY:357 CZ:420 DE:49 DJ:253 DK:45 DM:1 DO:1 DZ:213 EC:593 EE:372 EG:20 EH:212 ER:291 ES:34 ET:251 FI:358 FJ:679 FK:500 FM:691 FO:298 FR:33 GA:241 GB:44 GD:1 GE:995 GF:594 GG:44 GH:233 GI:350 GL:299 GM:220 GN:224 GP:590 GQ:240 GR:30 GT:502 GU:1 GW:245 GY:592 HK:852 HN:504 HR:385 HT:509 HU:36 ID:62 IE:353 IL:972 IM:44 IN:91 IO:246 IQ:964 IR:98 IS:354 IT:39 JE:44 JM:1 JO:962 JP:81 KE:254 KG:996 KH:855 KI:686 KM:269 KN:1 KP:850 KR:82 KW:965 KY:1 KZ:7 LA:856 LB:961 LC:1 LI:423 LK:94 LR:231 LS:266 LT:370 LU:352 LV:371 LY:218 MA:212 MC:377 MD:373 ME:382 MF:590 MG:261 MH:692 MK:389 ML:223 MM:95 MN:976 MO:853 MP:1 MQ:596 MR:222 MS:1 MT:356 MU:230 MV:960 MW:265 MX:52 MY:60 MZ:258 NA:264 NC:687 NE:227 NF:672 NG:234 NI:505 NL:31 NO:47 NP:977 NR:674 NU:683 NZ:64 OM:968 PA:507 PE:51 PF:689 PG:675 PH:63 PK:92 PL:48 PM:508 PR:1 PS:970 PT:351 PW:680 PY:595 QA:974 RE:262 RO:40 RS:381 RU:7 RW:250 SA:966 SB:677 SC:248 SD:249 SE:46 SG:65 SH:290 SI:386 SJ:47 SK:421 SL:232 SM:378 SN:221 SO:252 SR:597 SS:211 ST:239 SV:503 SX:1 SY:963 SZ:268 TA:290 TC:1 TD:235 TG:228 TH:66 TJ:992 TK:690 TL:670 TM:993 TN:216 TO:676 TR:90 TT:1 TV:688 TW:886 TZ:255 UA:380 UG:256 US:1 UY:598 UZ:998 VA:39 VC:1 VE:58 VG:1 VI:1 VN:84 VU:678 WF:681 WS:685 XK:383 YE:967 YT:262 ZA:27 ZM:260 ZW:263".split())

def normalize_phone(params):
phone = params.get("phone")
country = None
if isinstance(phone, dict):
country = phone.get("countryShortName")
phone = phone.get("phone")
if not isinstance(phone, str) or not phone.strip():
raise ValueError("Phone is missing. Set Phone and Timezone before enrolling.")
phone = re.sub(r"[\s().-]", "", phone.strip())
if phone.startswith("00"):
phone = "+" + phone[2:]
elif not phone.startswith("+"):
calling_code = COUNTRY_CALLING_CODES.get(country.upper()) if isinstance(country, str) else None
# Monday may store an international number without its leading plus sign.
if calling_code and phone.startswith(calling_code):
phone = "+" + phone
if not re.fullmatch(r"\+[1-9][0-9]{6,14}", phone):
raise ValueError("Phone needs an international country code matching its selected country. Set Timezone manually if needed.")
return phone

def resolve_timezone(params):
existing = params.get("timezone")
if existing is not None and not isinstance(existing, str):
raise ValueError("Timezone must be a text column.")
if existing and existing.strip():
return existing

phone = normalize_phone({"phone": params.get("phone")})
digits = phone[1:]

if digits.startswith("1"):
if not re.fullmatch(r"1[2-9][0-9]{2}[2-9][0-9]{6}", digits):
raise ValueError("Invalid +1 phone number. Correct Phone before enrolling.")
for length in range(len(digits), 0, -1):
zones = NANPA_ZONES.get(digits[:length])
if zones is not None:
if len(zones) == 1:
return zones[0]
raise ValueError("Phone matches multiple timezones. Set the Timezone column before enrolling.")
else:
for length in (3, 2, 1):
zone = SINGLE_ZONE_CODES.get(digits[:length])
if zone is not None and len(digits) - length >= 4:
return zone

raise ValueError("Cannot determine one timezone from Phone. Set the Timezone column before enrolling.")

import json
import urllib.request


def monday_api(params):
request = urllib.request.Request(
"https://api.monday.com/v2",
data=json.dumps(params).encode("utf-8"),
headers={"Content-Type": "application/json"},
method="POST",
)
# Monday's Code runtime authenticates requests to its API.
with urllib.request.urlopen(request, timeout=20) as response:
body = json.loads(response.read().decode("utf-8"))
if body.get("errors"):
raise ValueError("Monday API failed: " + "; ".join(error["message"] for error in body["errors"]))
return body["data"]

def discover_contact_columns(params):
item = params["item"]
selected = {}
for column_type, label in (("phone", "Phone"), ("world_clock", "Timezone")):
matches = [column for column in item["column_values"] if column["type"] == column_type]
if len(matches) != 1:
raise ValueError("Expected exactly one " + label + " column on the contact's board; found " + str(len(matches)) + ". Enrollment stopped.")
selected[column_type] = matches[0]
return {"board_id": item["board"]["id"], "phone": selected["phone"], "timezone": selected["world_clock"]}

def fill_timezone(params):
item_id = str(params.get("item_id", ""))
if not re.fullmatch(r"[1-9][0-9]*", item_id):
raise ValueError("A valid triggering Item ID is required.")
data = monday_api({
"query": "query ($ids: [ID!]!) { items(ids: $ids) { id board { id } column_values { id type value ... on WorldClockValue { timezone } } } }",
"variables": {"ids": [item_id]},
})
if len(data["items"]) != 1:
raise ValueError("The triggering contact could not be found or accessed. Enrollment stopped.")
contact = discover_contact_columns({"item": data["items"][0]})
existing = contact["timezone"]["timezone"]
if existing:
return existing
phone = json.loads(contact["phone"]["value"] or "{}")
timezone = resolve_timezone({"phone": phone, "timezone": ""})
result = monday_api({
"query": "mutation ($board: ID!, $item: ID!, $values: JSON!) { change_multiple_column_values(board_id: $board, item_id: $item, column_values: $values) { id column_values { id ... on WorldClockValue { timezone } } } }",
"variables": {"board": contact["board_id"], "item": item_id, "values": json.dumps({contact["timezone"]["id"]: {"timezone": timezone}})},
})
saved = next(column for column in result["change_multiple_column_values"]["column_values"] if column["id"] == contact["timezone"]["id"])
if saved["timezone"] != timezone:
raise ValueError("Monday did not save the resolved timezone. Enrollment stopped.")
return timezone

return {"timezone": fill_timezone({"item_id": input.get("item_id")})}

How it works​

The block reads the item's Phone column. It looks up the timezone from the area code for +1 numbers and from the country code for other numbers, then saves it to the World Clock column.

The block stops the automation with an error when the number doesn't match exactly one timezone, as in countries with several timezones. Set the Timezone column by hand for those contacts, then run the workflow again.