User:DAlangi (WMF)/common.js

mw.loader.using( [	'oojs-ui',	'oojs-ui-core',	'mediawiki.widgets.DateInputWidget' ] ).done( function {	$( function  { var dateInput = new mw.widgets.DateInputWidget; var $label = $( ' ' ); $( '#mw-content-text' ).append( $label, dateInput.$element ); dateInput.on( 'change', function {		    // The value will always be a valid date or empty string, malformed input is ignored		    var date = dateInput.getValue;		    $label.text( 'Selected date: ' + ( date || '(none)' ) );		    // Put in a format our lua script will feed on		    date = date.split('-');		    // In DD/MM/YYYY format		    date = date[2] + "/" + date[1] + "/" + date[0];		    console.log(date);		} ); } ); } );