Advanced search date field accepts years with more than four digits without validation

:information_source: Overview

The date field in Advanced Search allows users to enter years with more than four digits, which results in an unsupported search query.

:walking_woman: Steps to reproduce

  1. Search for discourse on Meta using Chrome.

  2. Expand Advanced filters.

  3. Under Posted, select before.

  4. Enter November 12, 2026.

  5. Replace the year 2026 with 202666 and press Tab.

  6. Click Search.

:white_check_mark: Expected results

The year should be limited to four digits, or a validation message should be displayed.

:x: Observed results

The date field accepts the six-digit year and submits discourse before:202666-11-12 without any validation message.

:books: Additional context

The native date input has no max restriction, while the search backend expects a four-digit year.

A fix is already in review: FIX: Cap the year in native date inputs at four digits - Pull Request #47255 - discourse/discourse - GitHub