blob: bf6408a549b32431fd70e4435512e0c8b5522bdd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/*!
* JavaScript functions for embedding jQuery controls
* into translation notification form.
*
* @author Amir E. Aharoni
* @author Siebrand Mazeland
* @author Niklas Laxström
* @copyright Copyright © 2012-2013 Amir E. Aharoni, Siebrand Mazeland
* @license GPL-2.0-or-later
*/
( function () {
'use strict';
$( function () {
var widget, defaultValue, defaultDate,
$input = $( '#start' );
defaultDate = new Date();
defaultDate.setDate( 1 );
if ( $input.val() ) {
defaultValue = new Date( $input.val() );
}
widget = new mw.widgets.datetime.DateTimeInputWidget( {
formatter: {
format: '${year|0}-${month|0}-${day|0}',
defaultDate: defaultDate
},
type: 'date',
value: defaultValue,
max: new Date()
} );
$input.after( widget.$element ).hide();
widget.on( 'change', function ( data ) {
$input.val( data + 'T00:00:00' );
} );
} );
}() );
|