material-components-web-elm icon indicating copy to clipboard operation
material-components-web-elm copied to clipboard

TextField setMin and setMax should take String, not Int

Open tillydray opened this issue 2 years ago • 2 comments

setMin and setMax both have a type signature of Maybe Int -> Config msg -> Config msg, but I believe they should be Maybe String -> Config msg -> Config msg. Confusingly, the docs for min say, "the min attribute is a number that specifies the most negative value a form control to be considered valid." However, the examples are mostly strings, and I don't know how one would represent a minimal iso8601 date as anything other than a string. I have 2 PRs to update the MDN docs, assuming I'm not wrong about this.

From MDN:

Input type Example Example
date yyyy-mm-dd <input type="date" min="2019-12-25" step="1">
month yyyy-mm <input type="month" min="2019-12" step="12">
week yyyy-W## <input type="week" min="2019-W23" step="">
time hh:mm <input type="time" min="09:00" step="900">
datetime-local yyyy-mm-ddThh:mm <input type="datetime-local" min="2019-12-25T19:30">
number <number> <input type="number" min="0" step="5" max="100">
range <number> <input type="range" min="60" step="5" max="100">

tillydray avatar Mar 30 '22 20:03 tillydray

Hi @JasonMFry, thanks for opening this issue. That sounds very reasonable! Would you happen to want to submit a PR? :-)

aforemny avatar Mar 31 '22 02:03 aforemny

Would you happen to want to submit a PR? :-)

I would, but I don't have time or energy right now :(

tillydray avatar Apr 05 '22 13:04 tillydray