JSFiddle - React, Tailwind, and code Playground
HTML
<input id="id_year" name="year" type="number">
JavaScript
console.clear();
$(document).ready(function () {
var year = $("#id_year");
year.datepicker({
dateFormat: "yy", // Notice the Extra space at the beginning
viewMode: "years",
minViewMode: "years"
});
year.on('changeDate', function(ev){
console.log("ssds");
year.attr('value',ev.date.getFullYear());
});
});