DateTimeInputWidget: Set type before calling parent constructor
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 18 Apr 2016 18:45:27 +0000 (14:45 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Mon, 18 Apr 2016 18:45:27 +0000 (14:45 -0400)
This way when the parent calls setValue() which calls cleanUpValue(), it
cleans up the value correctly.

Change-Id: I9dcfa74ca03f6aded1dd0f9593d24b0986596b41

resources/src/mediawiki.widgets.datetime/DateTimeInputWidget.js

index 7f36137..01d3442 100644 (file)
@@ -55,6 +55,9 @@
                        config.formatter.format = '@' + config.type;
                }
 
+               // Early properties
+               this.type = config.type;
+
                // Parent constructor
                mw.widgets.datetime.DateTimeInputWidget[ 'super' ].call( this, config );
 
@@ -64,7 +67,6 @@
                OO.ui.mixin.PendingElement.call( this, config );
 
                // Properties
-               this.type = config.type;
                this.$handle = $( '<span>' );
                this.$fields = $( '<span>' );
                this.fields = [];