We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
tests/test_passport.py::TestEnUS::testDates failure: ValueError: day is out of range for month
* Faker version: 18.10.0
* OS: Gentoo Linux amd64

It's possible that I've been incredibly lucky:

```
>           expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
E           ValueError: day is out of range for month
[…]
expiry_years = 10
issue_date = datetime.datetime(2020, 2, 29, 6, 57, 56)
```

Full traceback below.

### Steps to reproduce

1. `python -m pytest` ;-)

### Expected behavior

Tests passing ;-).

### Actual behavior

```pytb
_________________________________________________________ TestEnUS.testDates __________________________________________________________

self = <tests.test_passport.TestEnUS object at 0x7f6db2c3a920>, faker = <faker.proxy.Faker object at 0x7f6db21159f0>, num_samples = 20

    def testDates(self, faker, num_samples=20):
        age4 = date.today() - timedelta(days=4 * 365)
        age12 = date.today() - timedelta(days=12 * 365)
        age17 = date.today() - timedelta(days=17 * 365)
        age23 = date.today() - timedelta(days=23 * 365)
        age30 = date.today() - timedelta(days=30 * 365)
    
        birthdays = [(age4, 4), (age12, 12), (age17, 17), (age23, 23), (age30, 30)]
        for _ in range(num_samples):
            for birthday in birthdays:
>               birth_date_f, issue_date_f, expiry_date_f = faker.passport_dates(birthday[0])

_          = 4
age12      = datetime.date(2011, 6, 5)
age17      = datetime.date(2006, 6, 6)
age23      = datetime.date(2000, 6, 7)
age30      = datetime.date(1993, 6, 9)
age4       = datetime.date(2019, 6, 3)
birth_date = datetime.date(2006, 6, 6)
birth_date_f = '06 Jun 2006'
birthday   = (datetime.date(2000, 6, 7), 23)
birthdays  = [(datetime.date(2019, 6, 3), 4),
 (datetime.date(2011, 6, 5), 12),
 (datetime.date(2006, 6, 6), 17),
 (datetime.date(2000, 6, 7), 23),
 (datetime.date(1993, 6, 9), 30)]
expiry_date = datetime.date(2025, 4, 8)
expiry_date_f = '08 Apr 2025'
faker      = <faker.proxy.Faker object at 0x7f6db21159f0>
issue_date = datetime.date(2020, 4, 8)
issue_date_f = '08 Apr 2020'
num_samples = 20
self       = <tests.test_passport.TestEnUS object at 0x7f6db2c3a920>

tests/test_passport.py:55: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <faker.providers.passport.en_US.Provider object at 0x7f6db20938b0>, birthday = datetime.date(2000, 6, 7)

    def passport_dates(self, birthday: date = date.today()) -> Tuple[str, str, str]:
        """Generates a formatted date of birth, issue, and expiration dates.
        issue and expiration dates are conditioned to fall within U.S. standards of 5 and 10 year expirations
    
    
        The ``birthday`` argument is a datetime.date object representing a date of birth.
    
        Sources:
    
        -https://travel.state.gov/content/travel/en/passports/passport-help/faqs.html
        """
        birth_date = birthday.strftime("%d ") + birthday.strftime("%b ") + birthday.strftime("%Y")
        today = date.today()
        age = (today - birthday).days // 365
        if age < 16:
            expiry_years = 5
            issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)
            # Checks if age is less than 5 so issue date is not before birthdate
            if age < 5:
                issue_date = self.generator.date_time_between(birthday, today)
            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
    
            issue_date_fromat = issue_date.strftime("%d ") + issue_date.strftime("%b ") + issue_date.strftime("%Y")
            expiry_date_format = expiry_date.strftime("%d ") + expiry_date.strftime("%b ") + expiry_date.strftime("%Y")
            return birth_date, issue_date_fromat, expiry_date_format
        elif age >= 26:
            expiry_years = 10
            issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)
            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
            issue_date_fromat = issue_date.strftime("%d ") + issue_date.strftime("%b ") + issue_date.strftime("%Y")
            expiry_date_format = expiry_date.strftime("%d ") + expiry_date.strftime("%b ") + expiry_date.strftime("%Y")
            return birth_date, issue_date_fromat, expiry_date_format
    
        else:
            # In cases between age 16 and 26, the issue date is 5 years ago, but expiry may be in 10 or 5 years
            expiry_years = 5
            issue_date = self.generator.date_time_between(
                today - timedelta(days=expiry_years * 365 - 1), birthday + timedelta(days=16 * 365 - 1)
            )
            # all people over 21 must have been over 16 when they recieved passport or it will be expired otherwise
            if age >= 21:
                issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)
                expiry_years = 10
    
>           expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
E           ValueError: day is out of range for month

age        = 23
birth_date = '07 Jun 2000'
birthday   = datetime.date(2000, 6, 7)
expiry_years = 10
issue_date = datetime.datetime(2020, 2, 29, 6, 57, 56)
self       = <faker.providers.passport.en_US.Provider object at 0x7f6db20938b0>
today      = datetime.date(2023, 6, 2)

faker/providers/passport/en_US/__init__.py:69: ValueError
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `faker/providers/passport/en_US/__init__.py`
Content:
```
1 import random
2 
3 from datetime import date, timedelta
4 from typing import Tuple
5 
6 from .. import Provider as PassportProvider
7 
8 
9 class Provider(PassportProvider):
10     """Implement passport provider for ``en_US`` locale.
11 
12     Sources:
13 
14     - https://travel.state.gov/content/travel/en/passports/passport-help/next-generation-passport.html
15     - https://www.vitalrecordsonline.com/glossary/passport-book-number
16     """
17 
18     passport_number_formats = (
19         # NGP
20         "?########",
21         # Pre-NGP
22         "#########",
23     )
24 
25     def passport_dates(self, birthday: date = date.today()) -> Tuple[str, str, str]:
26         """Generates a formatted date of birth, issue, and expiration dates.
27         issue and expiration dates are conditioned to fall within U.S. standards of 5 and 10 year expirations
28 
29 
30         The ``birthday`` argument is a datetime.date object representing a date of birth.
31 
32         Sources:
33 
34         -https://travel.state.gov/content/travel/en/passports/passport-help/faqs.html
35         """
36         birth_date = birthday.strftime("%d ") + birthday.strftime("%b ") + birthday.strftime("%Y")
37         today = date.today()
38         age = (today - birthday).days // 365
39         if age < 16:
40             expiry_years = 5
41             issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)
42             # Checks if age is less than 5 so issue date is not before birthdate
43             if age < 5:
44                 issue_date = self.generator.date_time_between(birthday, today)
45             expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
46 
47             issue_date_fromat = issue_date.strftime("%d ") + issue_date.strftime("%b ") + issue_date.strftime("%Y")
48             expiry_date_format = expiry_date.strftime("%d ") + expiry_date.strftime("%b ") + expiry_date.strftime("%Y")
49             return birth_date, issue_date_fromat, expiry_date_format
50         elif age >= 26:
51             expiry_years = 10
52             issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)
53             expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
54             issue_date_fromat = issue_date.strftime("%d ") + issue_date.strftime("%b ") + issue_date.strftime("%Y")
55             expiry_date_format = expiry_date.strftime("%d ") + expiry_date.strftime("%b ") + expiry_date.strftime("%Y")
56             return birth_date, issue_date_fromat, expiry_date_format
57 
58         else:
59             # In cases between age 16 and 26, the issue date is 5 years ago, but expiry may be in 10 or 5 years
60             expiry_years = 5
61             issue_date = self.generator.date_time_between(
62                 today - timedelta(days=expiry_years * 365 - 1), birthday + timedelta(days=16 * 365 - 1)
63             )
64             # all people over 21 must have been over 16 when they recieved passport or it will be expired otherwise
65             if age >= 21:
66                 issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)
67                 expiry_years = 10
68 
69             expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
70 
71             issue_date_fromat = issue_date.strftime("%d ") + issue_date.strftime("%b ") + issue_date.strftime("%Y")
72             expiry_date_format = expiry_date.strftime("%d ") + expiry_date.strftime("%b ") + expiry_date.strftime("%Y")
73             return birth_date, issue_date_fromat, expiry_date_format
74 
75     def passport_gender(self, seed: int = 0) -> str:
76         """Generates a string representing the gender displayed on a passport
77 
78         Sources:
79 
80         - https://williamsinstitute.law.ucla.edu/publications/x-gender-markers-passports/
81         """
82         if seed != 0:
83             random.seed(seed)
84 
85         genders = ["M", "F", "X"]
86         gender = random.choices(genders, weights=[0.493, 0.493, 0.014], k=1)[0]
87         return gender
88 
89     def passport_full(self) -> str:
90         """Generates a formatted sting with US Passport information"""
91         dob = self.passport_dob()
92         birth_date, issue_date, expiry_date = self.passport_dates(dob)
93         gender_g = self.passport_gender()
94         given_name, surname = self.passport_owner(gender=gender_g)
95         number = self.passport_number()
96 
97         full_rep = """{first_name}\n{second_name}\n{gender}\n{dob}\n{issue}\n{expire}\n{num}\n"""
98         full_rep = full_rep.format(
99             first_name=given_name,
100             second_name=surname,
101             gender=gender_g,
102             dob=birth_date,
103             issue=issue_date,
104             expire=expiry_date,
105             num=number,
106         )
107         return full_rep
108
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/faker/providers/passport/en_US/__init__.py b/faker/providers/passport/en_US/__init__.py
--- a/faker/providers/passport/en_US/__init__.py
+++ b/faker/providers/passport/en_US/__init__.py
@@ -42,19 +42,9 @@
             # Checks if age is less than 5 so issue date is not before birthdate
             if age < 5:
                 issue_date = self.generator.date_time_between(birthday, today)
-            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
-
-            issue_date_fromat = issue_date.strftime("%d ") + issue_date.strftime("%b ") + issue_date.strftime("%Y")
-            expiry_date_format = expiry_date.strftime("%d ") + expiry_date.strftime("%b ") + expiry_date.strftime("%Y")
-            return birth_date, issue_date_fromat, expiry_date_format
         elif age >= 26:
             expiry_years = 10
             issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)
-            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
-            issue_date_fromat = issue_date.strftime("%d ") + issue_date.strftime("%b ") + issue_date.strftime("%Y")
-            expiry_date_format = expiry_date.strftime("%d ") + expiry_date.strftime("%b ") + expiry_date.strftime("%Y")
-            return birth_date, issue_date_fromat, expiry_date_format
-
         else:
             # In cases between age 16 and 26, the issue date is 5 years ago, but expiry may be in 10 or 5 years
             expiry_years = 5
@@ -66,11 +56,13 @@
                 issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)
                 expiry_years = 10
 
-            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
+        if issue_date.day == 29 and issue_date.month == 2:
+            issue_date -= timedelta(days=1)
+        expiry_date = issue_date.replace(year=issue_date.year + expiry_years)
 
-            issue_date_fromat = issue_date.strftime("%d ") + issue_date.strftime("%b ") + issue_date.strftime("%Y")
-            expiry_date_format = expiry_date.strftime("%d ") + expiry_date.strftime("%b ") + expiry_date.strftime("%Y")
-            return birth_date, issue_date_fromat, expiry_date_format
+        issue_date_format = issue_date.strftime("%d ") + issue_date.strftime("%b ") + issue_date.strftime("%Y")
+        expiry_date_format = expiry_date.strftime("%d ") + expiry_date.strftime("%b ") + expiry_date.strftime("%Y")
+        return birth_date, issue_date_format, expiry_date_format
 
     def passport_gender(self, seed: int = 0) -> str:
         """Generates a string representing the gender displayed on a passport

{"golden_diff": "diff --git a/faker/providers/passport/en_US/__init__.py b/faker/providers/passport/en_US/__init__.py\n--- a/faker/providers/passport/en_US/__init__.py\n+++ b/faker/providers/passport/en_US/__init__.py\n@@ -42,19 +42,9 @@\n             # Checks if age is less than 5 so issue date is not before birthdate\n             if age < 5:\n                 issue_date = self.generator.date_time_between(birthday, today)\n-            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\n-\n-            issue_date_fromat = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\n-            expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\n-            return birth_date, issue_date_fromat, expiry_date_format\n         elif age >= 26:\n             expiry_years = 10\n             issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\n-            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\n-            issue_date_fromat = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\n-            expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\n-            return birth_date, issue_date_fromat, expiry_date_format\n-\n         else:\n             # In cases between age 16 and 26, the issue date is 5 years ago, but expiry may be in 10 or 5 years\n             expiry_years = 5\n@@ -66,11 +56,13 @@\n                 issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\n                 expiry_years = 10\n \n-            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\n+        if issue_date.day == 29 and issue_date.month == 2:\n+            issue_date -= timedelta(days=1)\n+        expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\n \n-            issue_date_fromat = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\n-            expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\n-            return birth_date, issue_date_fromat, expiry_date_format\n+        issue_date_format = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\n+        expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\n+        return birth_date, issue_date_format, expiry_date_format\n \n     def passport_gender(self, seed: int = 0) -> str:\n         \"\"\"Generates a string representing the gender displayed on a passport\n", "issue": "tests/test_passport.py::TestEnUS::testDates failure: ValueError: day is out of range for month\n* Faker version: 18.10.0\r\n* OS: Gentoo Linux amd64\r\n\r\nIt's possible that I've been incredibly lucky:\r\n\r\n```\r\n>           expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\r\nE           ValueError: day is out of range for month\r\n[\u2026]\r\nexpiry_years = 10\r\nissue_date = datetime.datetime(2020, 2, 29, 6, 57, 56)\r\n```\r\n\r\nFull traceback below.\r\n\r\n### Steps to reproduce\r\n\r\n1. `python -m pytest` ;-)\r\n\r\n### Expected behavior\r\n\r\nTests passing ;-).\r\n\r\n### Actual behavior\r\n\r\n```pytb\r\n_________________________________________________________ TestEnUS.testDates __________________________________________________________\r\n\r\nself = <tests.test_passport.TestEnUS object at 0x7f6db2c3a920>, faker = <faker.proxy.Faker object at 0x7f6db21159f0>, num_samples = 20\r\n\r\n    def testDates(self, faker, num_samples=20):\r\n        age4 = date.today() - timedelta(days=4 * 365)\r\n        age12 = date.today() - timedelta(days=12 * 365)\r\n        age17 = date.today() - timedelta(days=17 * 365)\r\n        age23 = date.today() - timedelta(days=23 * 365)\r\n        age30 = date.today() - timedelta(days=30 * 365)\r\n    \r\n        birthdays = [(age4, 4), (age12, 12), (age17, 17), (age23, 23), (age30, 30)]\r\n        for _ in range(num_samples):\r\n            for birthday in birthdays:\r\n>               birth_date_f, issue_date_f, expiry_date_f = faker.passport_dates(birthday[0])\r\n\r\n_          = 4\r\nage12      = datetime.date(2011, 6, 5)\r\nage17      = datetime.date(2006, 6, 6)\r\nage23      = datetime.date(2000, 6, 7)\r\nage30      = datetime.date(1993, 6, 9)\r\nage4       = datetime.date(2019, 6, 3)\r\nbirth_date = datetime.date(2006, 6, 6)\r\nbirth_date_f = '06 Jun 2006'\r\nbirthday   = (datetime.date(2000, 6, 7), 23)\r\nbirthdays  = [(datetime.date(2019, 6, 3), 4),\r\n (datetime.date(2011, 6, 5), 12),\r\n (datetime.date(2006, 6, 6), 17),\r\n (datetime.date(2000, 6, 7), 23),\r\n (datetime.date(1993, 6, 9), 30)]\r\nexpiry_date = datetime.date(2025, 4, 8)\r\nexpiry_date_f = '08 Apr 2025'\r\nfaker      = <faker.proxy.Faker object at 0x7f6db21159f0>\r\nissue_date = datetime.date(2020, 4, 8)\r\nissue_date_f = '08 Apr 2020'\r\nnum_samples = 20\r\nself       = <tests.test_passport.TestEnUS object at 0x7f6db2c3a920>\r\n\r\ntests/test_passport.py:55: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\nself = <faker.providers.passport.en_US.Provider object at 0x7f6db20938b0>, birthday = datetime.date(2000, 6, 7)\r\n\r\n    def passport_dates(self, birthday: date = date.today()) -> Tuple[str, str, str]:\r\n        \"\"\"Generates a formatted date of birth, issue, and expiration dates.\r\n        issue and expiration dates are conditioned to fall within U.S. standards of 5 and 10 year expirations\r\n    \r\n    \r\n        The ``birthday`` argument is a datetime.date object representing a date of birth.\r\n    \r\n        Sources:\r\n    \r\n        -https://travel.state.gov/content/travel/en/passports/passport-help/faqs.html\r\n        \"\"\"\r\n        birth_date = birthday.strftime(\"%d \") + birthday.strftime(\"%b \") + birthday.strftime(\"%Y\")\r\n        today = date.today()\r\n        age = (today - birthday).days // 365\r\n        if age < 16:\r\n            expiry_years = 5\r\n            issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\r\n            # Checks if age is less than 5 so issue date is not before birthdate\r\n            if age < 5:\r\n                issue_date = self.generator.date_time_between(birthday, today)\r\n            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\r\n    \r\n            issue_date_fromat = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\r\n            expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\r\n            return birth_date, issue_date_fromat, expiry_date_format\r\n        elif age >= 26:\r\n            expiry_years = 10\r\n            issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\r\n            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\r\n            issue_date_fromat = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\r\n            expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\r\n            return birth_date, issue_date_fromat, expiry_date_format\r\n    \r\n        else:\r\n            # In cases between age 16 and 26, the issue date is 5 years ago, but expiry may be in 10 or 5 years\r\n            expiry_years = 5\r\n            issue_date = self.generator.date_time_between(\r\n                today - timedelta(days=expiry_years * 365 - 1), birthday + timedelta(days=16 * 365 - 1)\r\n            )\r\n            # all people over 21 must have been over 16 when they recieved passport or it will be expired otherwise\r\n            if age >= 21:\r\n                issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\r\n                expiry_years = 10\r\n    \r\n>           expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\r\nE           ValueError: day is out of range for month\r\n\r\nage        = 23\r\nbirth_date = '07 Jun 2000'\r\nbirthday   = datetime.date(2000, 6, 7)\r\nexpiry_years = 10\r\nissue_date = datetime.datetime(2020, 2, 29, 6, 57, 56)\r\nself       = <faker.providers.passport.en_US.Provider object at 0x7f6db20938b0>\r\ntoday      = datetime.date(2023, 6, 2)\r\n\r\nfaker/providers/passport/en_US/__init__.py:69: ValueError\r\n```\r\n\n", "before_files": [{"content": "import random\n\nfrom datetime import date, timedelta\nfrom typing import Tuple\n\nfrom .. import Provider as PassportProvider\n\n\nclass Provider(PassportProvider):\n    \"\"\"Implement passport provider for ``en_US`` locale.\n\n    Sources:\n\n    - https://travel.state.gov/content/travel/en/passports/passport-help/next-generation-passport.html\n    - https://www.vitalrecordsonline.com/glossary/passport-book-number\n    \"\"\"\n\n    passport_number_formats = (\n        # NGP\n        \"?########\",\n        # Pre-NGP\n        \"#########\",\n    )\n\n    def passport_dates(self, birthday: date = date.today()) -> Tuple[str, str, str]:\n        \"\"\"Generates a formatted date of birth, issue, and expiration dates.\n        issue and expiration dates are conditioned to fall within U.S. standards of 5 and 10 year expirations\n\n\n        The ``birthday`` argument is a datetime.date object representing a date of birth.\n\n        Sources:\n\n        -https://travel.state.gov/content/travel/en/passports/passport-help/faqs.html\n        \"\"\"\n        birth_date = birthday.strftime(\"%d \") + birthday.strftime(\"%b \") + birthday.strftime(\"%Y\")\n        today = date.today()\n        age = (today - birthday).days // 365\n        if age < 16:\n            expiry_years = 5\n            issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\n            # Checks if age is less than 5 so issue date is not before birthdate\n            if age < 5:\n                issue_date = self.generator.date_time_between(birthday, today)\n            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\n\n            issue_date_fromat = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\n            expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\n            return birth_date, issue_date_fromat, expiry_date_format\n        elif age >= 26:\n            expiry_years = 10\n            issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\n            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\n            issue_date_fromat = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\n            expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\n            return birth_date, issue_date_fromat, expiry_date_format\n\n        else:\n            # In cases between age 16 and 26, the issue date is 5 years ago, but expiry may be in 10 or 5 years\n            expiry_years = 5\n            issue_date = self.generator.date_time_between(\n                today - timedelta(days=expiry_years * 365 - 1), birthday + timedelta(days=16 * 365 - 1)\n            )\n            # all people over 21 must have been over 16 when they recieved passport or it will be expired otherwise\n            if age >= 21:\n                issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\n                expiry_years = 10\n\n            expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\n\n            issue_date_fromat = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\n            expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\n            return birth_date, issue_date_fromat, expiry_date_format\n\n    def passport_gender(self, seed: int = 0) -> str:\n        \"\"\"Generates a string representing the gender displayed on a passport\n\n        Sources:\n\n        - https://williamsinstitute.law.ucla.edu/publications/x-gender-markers-passports/\n        \"\"\"\n        if seed != 0:\n            random.seed(seed)\n\n        genders = [\"M\", \"F\", \"X\"]\n        gender = random.choices(genders, weights=[0.493, 0.493, 0.014], k=1)[0]\n        return gender\n\n    def passport_full(self) -> str:\n        \"\"\"Generates a formatted sting with US Passport information\"\"\"\n        dob = self.passport_dob()\n        birth_date, issue_date, expiry_date = self.passport_dates(dob)\n        gender_g = self.passport_gender()\n        given_name, surname = self.passport_owner(gender=gender_g)\n        number = self.passport_number()\n\n        full_rep = \"\"\"{first_name}\\n{second_name}\\n{gender}\\n{dob}\\n{issue}\\n{expire}\\n{num}\\n\"\"\"\n        full_rep = full_rep.format(\n            first_name=given_name,\n            second_name=surname,\n            gender=gender_g,\n            dob=birth_date,\n            issue=issue_date,\n            expire=expiry_date,\n            num=number,\n        )\n        return full_rep\n", "path": "faker/providers/passport/en_US/__init__.py"}], "after_files": [{"content": "import random\n\nfrom datetime import date, timedelta\nfrom typing import Tuple\n\nfrom .. import Provider as PassportProvider\n\n\nclass Provider(PassportProvider):\n    \"\"\"Implement passport provider for ``en_US`` locale.\n\n    Sources:\n\n    - https://travel.state.gov/content/travel/en/passports/passport-help/next-generation-passport.html\n    - https://www.vitalrecordsonline.com/glossary/passport-book-number\n    \"\"\"\n\n    passport_number_formats = (\n        # NGP\n        \"?########\",\n        # Pre-NGP\n        \"#########\",\n    )\n\n    def passport_dates(self, birthday: date = date.today()) -> Tuple[str, str, str]:\n        \"\"\"Generates a formatted date of birth, issue, and expiration dates.\n        issue and expiration dates are conditioned to fall within U.S. standards of 5 and 10 year expirations\n\n\n        The ``birthday`` argument is a datetime.date object representing a date of birth.\n\n        Sources:\n\n        -https://travel.state.gov/content/travel/en/passports/passport-help/faqs.html\n        \"\"\"\n        birth_date = birthday.strftime(\"%d \") + birthday.strftime(\"%b \") + birthday.strftime(\"%Y\")\n        today = date.today()\n        age = (today - birthday).days // 365\n        if age < 16:\n            expiry_years = 5\n            issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\n            # Checks if age is less than 5 so issue date is not before birthdate\n            if age < 5:\n                issue_date = self.generator.date_time_between(birthday, today)\n        elif age >= 26:\n            expiry_years = 10\n            issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\n        else:\n            # In cases between age 16 and 26, the issue date is 5 years ago, but expiry may be in 10 or 5 years\n            expiry_years = 5\n            issue_date = self.generator.date_time_between(\n                today - timedelta(days=expiry_years * 365 - 1), birthday + timedelta(days=16 * 365 - 1)\n            )\n            # all people over 21 must have been over 16 when they recieved passport or it will be expired otherwise\n            if age >= 21:\n                issue_date = self.generator.date_time_between(today - timedelta(days=expiry_years * 365 - 1), today)\n                expiry_years = 10\n\n        if issue_date.day == 29 and issue_date.month == 2:\n            issue_date -= timedelta(days=1)\n        expiry_date = issue_date.replace(year=issue_date.year + expiry_years)\n\n        issue_date_format = issue_date.strftime(\"%d \") + issue_date.strftime(\"%b \") + issue_date.strftime(\"%Y\")\n        expiry_date_format = expiry_date.strftime(\"%d \") + expiry_date.strftime(\"%b \") + expiry_date.strftime(\"%Y\")\n        return birth_date, issue_date_format, expiry_date_format\n\n    def passport_gender(self, seed: int = 0) -> str:\n        \"\"\"Generates a string representing the gender displayed on a passport\n\n        Sources:\n\n        - https://williamsinstitute.law.ucla.edu/publications/x-gender-markers-passports/\n        \"\"\"\n        if seed != 0:\n            random.seed(seed)\n\n        genders = [\"M\", \"F\", \"X\"]\n        gender = random.choices(genders, weights=[0.493, 0.493, 0.014], k=1)[0]\n        return gender\n\n    def passport_full(self) -> str:\n        \"\"\"Generates a formatted sting with US Passport information\"\"\"\n        dob = self.passport_dob()\n        birth_date, issue_date, expiry_date = self.passport_dates(dob)\n        gender_g = self.passport_gender()\n        given_name, surname = self.passport_owner(gender=gender_g)\n        number = self.passport_number()\n\n        full_rep = \"\"\"{first_name}\\n{second_name}\\n{gender}\\n{dob}\\n{issue}\\n{expire}\\n{num}\\n\"\"\"\n        full_rep = full_rep.format(\n            first_name=given_name,\n            second_name=surname,\n            gender=gender_g,\n            dob=birth_date,\n            issue=issue_date,\n            expire=expiry_date,\n            num=number,\n        )\n        return full_rep\n", "path": "faker/providers/passport/en_US/__init__.py"}]}