Skip to content

National part of the number is truncated in some cases #76

Description

@paulll

Some RU/KZ/BY (and maybe other) numbers are truncated if national part of the number starts with same digit as national trunk prefix which is 8 in that case:

  • for +78005553535 expected +78005553535, got +7005553535
  • for 88005553535 expected +78005553535, got +7005553535
  • for +375800111111 expected +375800111111, got +37500111111

Also RU numbers are always 11 digits in E164 form, so that +7005553535 is impossible number.

assert_eq!(
    parser::parse(Some(country::RU), "+78005553535").unwrap().format().to_string(),
    "+78005553535"
);

assert_eq!(
    parser::parse(Some(country::RU), "88005553535").unwrap().format().to_string(),
    "+78005553535"
);

assert_eq!(
    parser::parse(Some(country::BY), "+375800111111").unwrap().format().to_string(),
    "+375800111111"
);

Google libphonenumber handles that cases correctly: 1, 2, 3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions