Skip to content

DatePicker backspace behavior #2038

@tomasz13nocon

Description

@tomasz13nocon

Describe the bug

I have a few problems with how the backspace key works on the Date input field.

When I enter the wrong year, and press backspace, then continue typing, the padding zeroes are now treated as the actual year, causing the input to end after the next number. For example let's say I mistyped "1" when I wanted to start the year with "2". Hitting backspace, then "2" makes the focus jump away from the year and the year is now "0002":

2026-04-30.09-07-37.mp4

So then, let's say I want to remove all the zeroes when I make the mistake, but when I do, the month and day disappear as well which is very annoying to users, who have to retype the whole date:

2026-04-30.09-08-50.mp4

Note that the native HTML input[type="date"] doesn't have these issues, as pressing backspace simply resets the current segment (e.g. year).

Tested on Brave and Firefox - same behavior.

Reproduction

can be reproduced with the example date picker: https://www.bits-ui.com/docs/components/date-picker#input

Logs

System Info

System:
    OS: Linux 6.12 cpe:/o:nixos:nixos:25.11 25.11 (Xantusia)
    CPU: (12) x64 AMD Ryzen 5 7600X 6-Core Processor
    Memory: 15.64 GB / 30.47 GB
    Container: Yes
    Shell: 5.3.3 - /run/current-system/sw/bin/bash
  Binaries:
    Node: 24.14.0 - /run/current-system/sw/bin/node
    Yarn: 1.22.22 - /run/current-system/sw/bin/yarn
    npm: 11.9.0 - /run/current-system/sw/bin/npm
    pnpm: 10.33.0 - /run/current-system/sw/bin/pnpm
  Browsers:
    Brave Browser: 147.1.89.132
    Firefox: 149.0.2
    Firefox Developer Edition: 149.0.2

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions