2FA codes from Authenticator apps are based on time. This requires the time on your phone to be in-sync with the official time.
You can always disconnect your phone from the internet and it will successfully generate correct 2FA codes (so long as its time is still correct).
Please be aware that manual time settings and offline devices eventually slip out of sync. Should your phone's time get out of sync, or if you change time zones, you can easily fix this by changing the time settings on your phone from "Manual" to "Automatic".
|On iPhone||On Android|
Depending on the manufacturer of the phone, Android instructions may vary slightly.
You can also try using the Time Sync feature if you use Google Authenticator for Android as an alternative.