List of steps to reproduce
a = new mw.widgets.DateInputWidget() a.setValue('2002-05-25') console.log(a.getValue()) a.getValidity().then(() => console.log(true), () => console.log(false)) // "2002-05-25" // true
a = new mw.widgets.DateInputWidget({inputFormat: 'DD/MM/YYYY'}) a.setValue('2002-05-25') console.log(a.getValue()) a.getValidity().then(() => console.log(true), () => console.log(false)) // "2002-05-25" // false
What happens?:
date is invalid and mw.widgets.DateInputWidget.prototype.setValidityFlag() sets the flag to invalid; hence a red border appears around the html element
What should have happened instead?:
date is valid and html input element does not have a red border
Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
mw 1.38; i pasted the code into the dev console on https://www.mediawiki.org
mw.widgets.DateInputWidget.prototype.isValidDate creates a moment object with the custom date input format verifiying it against the internal date value yyyy-mm-dd; could the internal date format be used when comparing it against the internal date value?