Skip to content
Discussion options

You must be logged in to vote

Hey — the issue here isn't date-fns, it's working exactly right. The problem is a fundamental constraint of the HTML spec itself.

type="date" inputs always use yyyy-MM-dd — full stop. The HTML specification mandates that the value of a date input must be in yyyy-MM-dd format (e.g. 2026-07-02). This is true regardless of what you pass to it. If the value doesn't match that format exactly, the browser treats the field as empty. So when you set defaultValue="02-JUL-2026", the browser discards it silently.

The browser controls the visual display, not JavaScript. What you actually see in a date input (whether it renders as 07/02/2026, 02.07.2026, or something else) is determined entirely by th…

Replies: 3 comments 1 reply

This comment was marked as spam.

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Fred638
Comment options

Answer selected by Fred638
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Ask and answer questions about GitHub features and usage Programming Help Discussions around programming languages, open source and software development source:ui Discussions created via Community GitHub templates
4 participants