Skip to content

Commit

Permalink
support for 6-digit Estonian local numbers (with 372 country code)
Browse files Browse the repository at this point in the history
  • Loading branch information
angryziber committed Jan 31, 2024
1 parent 01c283d commit d05b191
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class Email(email: String): StringValue(email.trim().lowercase()) {
class Phone(phone: String): StringValue(phone.replace(removeChars, "")) {
companion object {
private val removeChars = "[\\s-()]+".toRegex()
private val valid = "\\+[0-9]{10,}".toRegex()
private val valid = "\\+[0-9]{9,}".toRegex()
}
init { require(valid.matches(value)) {
"International phone number should start with + and have at least 10 digits: $value" }
"International phone number should start with + and have at least 9 digits: $value" }
}
}

Expand Down

0 comments on commit d05b191

Please sign in to comment.