Skip to content

create a random phone number if the local phone format is not specified in the ID#10917

Closed
youssefelzedy wants to merge 1 commit intoopenstreetmap:developfrom
youssefelzedy:Show-a-random-phone-number-if-the-local-phone-format-is-not-defined-in-ID
Closed

create a random phone number if the local phone format is not specified in the ID#10917
youssefelzedy wants to merge 1 commit intoopenstreetmap:developfrom
youssefelzedy:Show-a-random-phone-number-if-the-local-phone-format-is-not-defined-in-ID

Conversation

@youssefelzedy
Copy link
Copy Markdown
Contributor

@youssefelzedy youssefelzedy commented Mar 24, 2025

While discussing #10916 @tyrasd suggested that he make a random phone number, as we did not find any number registered in our phone number format list

now I have created a new function that does the following:

  1. Generates a Random Country Code
    • Creates a country code between +1 and +99.
    • Example: +45, +83, +9
  2. Determines a Random Phone Number Length
    • The total number (including the country code) is 10 or 11 digits.
    • Adjusts the phone number length based on the country code length.
  3. Generates a Random Phone Number
    • Fills the number with random digits (0-9).
  4. Formats the Phone Number with Spaces
    • Inserts a space every 3 digits, except for the last 4 digits which remain grouped.
    • Example format: +45 123 456 7890
  5. Returns a Complete Formatted Phone Number
    • Example outputs:
      • +5 123 456 7890
      • +78 987 654 321
      • +99 543 210 9876

@tyrasd
Copy link
Copy Markdown
Member

tyrasd commented Mar 24, 2025

Why? 🙈

Sorry for the confusion, but in #10915 (comment), I meant that the current default placeholder +31… is just an arbitrary, unspecified, non-specific phone number. In that sense it is kind of random, but still perfectly fine as a placeholder if we don't have anything better. Making it actually random does not improve it at all.

If you want to improve it, open a PR on the tagging repository and replace the +31 placeholder with a country code that does not exist (maybe something like +876 or something else that's fun).

@tyrasd tyrasd closed this Mar 24, 2025
@youssefelzedy
Copy link
Copy Markdown
Contributor Author

I understood wrongly 🤦 😂
In general, I will work on it, I will first make sure that +876 does not belong to any country number

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants