Maybe you can use rollup or similar to bundle moment inside this lib and use tree-shaking to reduce the final size ?
About the polyfill, of course it is more complicated than that. There's no test of support, the value formatting is different, the optional HTML attributes are not handled etc. This would imply major changes in your library to mimic the standard.
I've introduced the type="date" attributes support (eg: min, max) and added format to the input attributes. This way, it can almost be a full polyfill, it'll still replace the type attribute with `text` so that the browser doesn't interfere with handled events/value.
Thank you, I appreciate the effort and the documentation. If you want to propose a full-polyfill behaviour, you could make a new module for that. Then you won't have to worry about the code size when adding the missing parts of the standard like valueAsDate: https://gist.github.com/sylvainpolletvillard/0aa9df9c180cd007e5e1
Indeed but it's an interesting idea. Anyway, you'll have to change type=date to type=text, at least programatically to ditch the navigator behavior...
Thanks about the bundle idea, I'll think about that. Thing is, if you're handling dates with javascript, you probably already use momentjs. IMO it's easier to let the end developper bundle everything his way.