Skip to content

US number start with 945 are considered as invalid #2

@bipinvaylu

Description

@bipinvaylu

I am using this library in my application on the login screen. One of the users reported that he is getting an invalid phone number error even though his phone number is valid.

Input phone number: +1-945-xxx-xxxx

Validation code: (PhoneNumberUtil's extension method)

import com.google.i18n.phonenumbers.PhoneNumberUtil
import timber.log.Timber

fun PhoneNumberUtil.isValidPhoneNumber(phoneNumber: String): Boolean {
    val phoneNumberProto = try {
        this.parse(phoneNumber, null)
    } catch (e: Exception) {
        Timber.e(
            e,
            "Error parsing phone number: $phoneNumber"
        )
        return false
    }
    return this.isValidNumber(phoneNumberProto)
}

Let me know if you need any other information to reproduce this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions