whisper-money/resources/js/pages/auth
Víctor Falcón 96ee311299
fix(register): don't block signup on unrecognized browser timezone (#462)
## Problem

Some users reported they couldn't register: they filled the form
correctly, pressed the button, saw a loading spinner, then got bounced
back to the registration page with **no error message**. Meanwhile 20-30
users register fine every day, and the issue wasn't reproducible by the
team.

## Root cause

The register form sends a **hidden, browser-auto-detected `timezone`**
field (`Intl.DateTimeFormat().resolvedOptions().timeZone`). The backend
validated it with Laravel's `timezone` rule:

```php
'timezone' => ['nullable', 'string', 'timezone'],
```

That rule rejects **legacy IANA aliases** that many browsers/OSes still
emit — e.g. `Asia/Calcutta`, `Asia/Saigon`, `Asia/Rangoon`,
`US/Pacific`. Proof on PHP 8.4:

```
in_array("Asia/Calcutta", DateTimeZone::listIdentifiers())  →  false
```

When validation failed, Fortify redirected back with a `timezone` error
— but the form had **no error display** for timezone (every other field
has one). Result: spinner → silent bounce → no message → and the user
can't fix a hidden field anyway. The team couldn't reproduce because
their browsers send canonical zones that pass. Production tzdata may
reject even more zones.

## Fix

- Stop validating the auto-detected hidden field against the strict
timezone list.
- Add `normalizeTimezone()`: keep recognized zones (including BC aliases
via `DateTimeZone::ALL_WITH_BC`), drop anything unrecognized to `null`.
Registration can never be blocked by it again.
- Surface `errors.timezone` in the form as a safety net so a
hidden-field failure can never be silent in the future.

## Tests

- Legacy alias `Asia/Calcutta` → registers, stored as-is.
- Unrecognized zone → registers, stored `null`.
- All existing registration tests pass (13 passed).
2026-06-01 09:03:15 +02:00
..
confirm-password.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
forgot-password.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
login.tsx Support soft-deleted users with reusable emails (#316) 2026-04-22 11:41:41 +01:00
register.tsx fix(register): don't block signup on unrecognized browser timezone (#462) 2026-06-01 09:03:15 +02:00
reset-password.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
setup-encryption.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
two-factor-challenge.tsx typo: Add missing space (#339) 2026-04-27 07:59:45 +01:00
verify-email.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00