{"action":"created","issue":{"url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/322","labels_url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/322/labels{/name}","comments_url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/322/comments","events_url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/322/events","html_url":"https://github.com/jackocnr/intl-tel-input/issues/322","id":116198272,"number":322,"title":"Format assumes local number before national number","user":{"login":"nlwillia","id":803755,"avatar_url":"https://avatars.githubusercontent.com/u/803755?v=3","gravatar_id":"","url":"https://api.github.com/users/nlwillia","html_url":"https://github.com/nlwillia","followers_url":"https://api.github.com/users/nlwillia/followers","following_url":"https://api.github.com/users/nlwillia/following{/other_user}","gists_url":"https://api.github.com/users/nlwillia/gists{/gist_id}","starred_url":"https://api.github.com/users/nlwillia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlwillia/subscriptions","organizations_url":"https://api.github.com/users/nlwillia/orgs","repos_url":"https://api.github.com/users/nlwillia/repos","events_url":"https://api.github.com/users/nlwillia/events{/privacy}","received_events_url":"https://api.github.com/users/nlwillia/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jackocnr/intl-tel-input/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-11-10T20:47:23Z","updated_at":"2016-01-29T18:05:20Z","closed_at":null,"body":"When `autoFormat` is enabled, intl-tel-input hands off formatting duties after each character event to libephonenumber's AsYouTypeFormatter.  This mode seems to assume that a local number is being entered until enough digits are typed, then it switches to a long distance number with an area code.\r\n\r\nThe result for a US number is that the user starts seeing a placeholder of \"(...) ...-....\" for a 10-digit number, but as they type they see the 7-digit \"...-....\" format first.  It only changes if they keep typing.  When someone intended to enter a 10-digit number from the start (which is almost always going to be the case for a web form), this is counter-intuitive.  Some users will stop and try to fix the format instead of continuing to type which frustrates them since they can't add characters that the widget thinks are invalid.\r\n\r\nI dug into libphonenumber a bit and found that the formats used are part of the big blob of configuration data that gets downloaded.  If I remove `[,\"(\\\\d{3})(\\\\d{4})\",\"$1-$2\",,\"\",\"\",1],` from the file in the US section, then the formatter starts with the assumption of a 10 digit number as preferred.\r\n\r\nAny suggestions of a better way to go about it?  For example, being able to provide a function that would return a custom format string for a country code would be cleaner than having to manually edit the data file."},"comment":{"url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/comments/176890355","html_url":"https://github.com/jackocnr/intl-tel-input/issues/322#issuecomment-176890355","issue_url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/322","id":176890355,"user":{"login":"jackocnr","id":1186883,"avatar_url":"https://avatars.githubusercontent.com/u/1186883?v=3","gravatar_id":"","url":"https://api.github.com/users/jackocnr","html_url":"https://github.com/jackocnr","followers_url":"https://api.github.com/users/jackocnr/followers","following_url":"https://api.github.com/users/jackocnr/following{/other_user}","gists_url":"https://api.github.com/users/jackocnr/gists{/gist_id}","starred_url":"https://api.github.com/users/jackocnr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackocnr/subscriptions","organizations_url":"https://api.github.com/users/jackocnr/orgs","repos_url":"https://api.github.com/users/jackocnr/repos","events_url":"https://api.github.com/users/jackocnr/events{/privacy}","received_events_url":"https://api.github.com/users/jackocnr/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T18:05:20Z","updated_at":"2016-01-29T18:05:20Z","body":"@alanmatuszak it's an interesting idea, but it would be weird if the user had added their own formatting chars, and then we immediately overrode that."}}