The countries in the North American Number Plan (US, Canada, etc) all have the same format, which is +1 (ppp) nnn-nnnn

They all have the country code +1. Some of the countries in the plan, like US, Canada, and Bermuda are formatted right, but I note that at least St. Lucia is not.

How can we most effectively fix this? Would it make sense to format based on country code == +1, or by country code?

As a temporary function, I have themed it with the following code added to the global formatting function:

    if (isset($custom_cc[$element['country_codes']])) {
      $function = $element['country_codes'] . '_formatter_default';
      if (function_exists($function)) {
        $phone = $function($element);
      }
	  
    } elseif ($cc['code']=="+1") { // if part of NANP, use US formatting
	  
	  $function = 'us_formatter_default';
	  $phone = $function($element);
	}

Comments

cayenne’s picture

Issue summary: View changes