<commit_before>/**
	_moon.DateTimePickerBase_ is a base kind implementing fuctionality shared
	by _moon.DatePicker_ and _moon.TimePicker_. It is not intended to be used
	directly.
*/
enyo.kind({
	name: "moon.DateTimePickerBase",
	kind: "moon.ExpandableListItem",
	defaultKind: "enyo.Control",
	classes: "moon-expandable-picker moon-date-picker",
	events: {
		/**
			Fires when the value changes.

			_inEvent.name_ contains the name of this control.

			_inEvent.value_ contains a standard JavaScript Date object representing
			the current value.
		*/
		onChange: ""
	},
	handlers: {
		//* Handler for _onChange_ events coming from constituent controls
		onChange: "handleChangeEvent"
	},
	published: {
		//* Text to be displayed in the _currentValue_ control if no item is
		//* currently selected
		noneText: "",
		/**
			The locale (in IETF format) used for picker formatting.

			This setting only applies when the iLib library is loaded.

			* When iLib is not present, US English (en-US) formatting is applied.
			
			* When iLib is present and _locale_ is set to the default value (`null`),
			the picker uses iLib's current locale (which iLib tries to determine
			from the system).

			* When iLib is present and an explicit _locale_ is provided, that locale
			will be used (regardless of iLib's current locale).

			_locale_ may be changed after the picker is created, in which case the
			picker will	be reformatted to match the new setting.

		*/
		locale: null,
		/**
			The value, expressed as a standard JavaScript Date object. When a Date object
			is passed to _set("value")_, the control is updated to reflect the new
			value. _get("value")_ returns a Date object.
		*/
		value: null,
		/**
			When true, the picker uses a 12-hour clock (this value is ignored when ilib
			is loaded, since the meridiem will be set by the current locale)
		*/
		meridiemEnable: false
	},
	//*@protected
	iLibFormatType: null, // set in subkind
	defaultOrdering: null, // set in subkind
	componentOverrides: {
		headerWrapper: {components: [
			{name: "header", kind: "moon.Item", spotlight: false, classes: "moon-expandable-list-item-header moon-expandable-picker-header"},
			{name: "currentValue", kind: "moon.Item", spotlight: false, classes: "moon-expandable-picker-current-value"}
		]},
		client: {kind: "enyo.Control", classes: "enyo-tool-decorator moon-date-picker-client", onSpotlightLeft:"closePicker", onSpotlightSelect: "closePicker"}
	},
	create: function() {
		this.inherited(arguments);
		this.createComponent({kind: "enyo.Signals", onlocalechange: "handleLocaleChangeEvent"});
		this.initDefaults();
	},
	initILib: function() {
		var fmtParams = {
			type: this.iLibFormatType,
			timezone: "local",
			length: "full"
		};
		if (this.locale) {
			fmtParams.locale = this.locale;
			this.iLibLocale = null;
		} else {
			this.iLibLocale = ilib.getLocale();
		}
		this._tf = new ilib.DateFmt(fmtParams);
	},
	initDefaults: function() {
		var ordering;
		this.value = this.value || new Date();
		//Attempt to use the ilib lib (assuming that it is loaded)
		if (typeof ilib !== "undefined") {
			this.initILib();
			ordering = this._tf.getTemplate();
		} else {
			ordering = this.defaultOrdering;
		}
		this.setupPickers(ordering);
		this.noneTextChanged();
	},
	setupPickers: function(ordering) {
		// implement in subkind, calling this.inherited() at the end
		this.pickers = this.getClientControls();
	},
	formatValue: function() {
		// implement in subkind
	},
	handleChangeEvent: function(inSender, inEvent) {
		if (inEvent && inEvent.originator === this) {
			// Don't handle our own change events
			return;
		} else {
			this.updateValue(inSender, inEvent);
			return true;
		}
	},
	updateValue: function(inSender, inEvent) {
		// implement in subkind
	},
	valueChanged: function(inOld) {
		this.setChildPickers(inOld);
		this.doChange({name:this.name, value:this.value});
	},
	setChildPickers: function(inOld) {
		// implement in subkind
	},
	// If no item is selected, uses _this.noneText_ as current value.
	noneTextChanged: function() {
		if(this.value == null) {
			this.$.currentValue.setContent(this.getNoneText());
		} else {
			this.$.currentValue.setContent(this.formatValue());<commit_msg>Defect Fix - 37843 - onChange fires twice in Date/Time Picker<commit_after>/**
	_moon.DateTimePickerBase_ is a base kind implementing fuctionality shared
	by _moon.DatePicker_ and _moon.TimePicker_. It is not intended to be used
	directly.
*/
enyo.kind({
	name: "moon.DateTimePickerBase",
	kind: "moon.ExpandableListItem",
	defaultKind: "enyo.Control",
	classes: "moon-expandable-picker moon-date-picker",
	events: {
		/**
			Fires when the value changes.

			_inEvent.name_ contains the name of this control.

			_inEvent.value_ contains a standard JavaScript Date object representing
			the current value.
		*/
		onChange: ""
	},
	handlers: {
		//* Handler for _onChange_ events coming from constituent controls
		onChange: "handleChangeEvent"
	},
	published: {
		//* Text to be displayed in the _currentValue_ control if no item is
		//* currently selected
		noneText: "",
		/**
			The locale (in IETF format) used for picker formatting.

			This setting only applies when the iLib library is loaded.

			* When iLib is not present, US English (en-US) formatting is applied.
			
			* When iLib is present and _locale_ is set to the default value (`null`),
			the picker uses iLib's current locale (which iLib tries to determine
			from the system).

			* When iLib is present and an explicit _locale_ is provided, that locale
			will be used (regardless of iLib's current locale).

			_locale_ may be changed after the picker is created, in which case the
			picker will	be reformatted to match the new setting.

		*/
		locale: null,
		/**
			The value, expressed as a standard JavaScript Date object. When a Date object
			is passed to _set("value")_, the control is updated to reflect the new
			value. _get("value")_ returns a Date object.
		*/
		value: null,
		/**
			When true, the picker uses a 12-hour clock (this value is ignored when ilib
			is loaded, since the meridiem will be set by the current locale)
		*/
		meridiemEnable: false
	},
	//*@protected
	iLibFormatType: null, // set in subkind
	defaultOrdering: null, // set in subkind
	componentOverrides: {
		headerWrapper: {components: [
			{name: "header", kind: "moon.Item", spotlight: false, classes: "moon-expandable-list-item-header moon-expandable-picker-header"},
			{name: "currentValue", kind: "moon.Item", spotlight: false, classes: "moon-expandable-picker-current-value"}
		]},
		client: {kind: "enyo.Control", classes: "enyo-tool-decorator moon-date-picker-client", onSpotlightLeft:"closePicker", onSpotlightSelect: "closePicker"}
	},
	create: function() {
		this.inherited(arguments);
		this.createComponent({kind: "enyo.Signals", onlocalechange: "handleLocaleChangeEvent"});
		this.initDefaults();
	},
	initILib: function() {
		var fmtParams = {
			type: this.iLibFormatType,
			timezone: "local",
			length: "full"
		};
		if (this.locale) {
			fmtParams.locale = this.locale;
			this.iLibLocale = null;
		} else {
			this.iLibLocale = ilib.getLocale();
		}
		this._tf = new ilib.DateFmt(fmtParams);
	},
	initDefaults: function() {
		var ordering;
		this.value = this.value || new Date();
		//Attempt to use the ilib lib (assuming that it is loaded)
		if (typeof ilib !== "undefined") {
			this.initILib();
			ordering = this._tf.getTemplate();
		} else {
			ordering = this.defaultOrdering;
		}
		this.setupPickers(ordering);
		this.noneTextChanged();
	},
	setupPickers: function(ordering) {
		// implement in subkind, calling this.inherited() at the end
		this.pickers = this.getClientControls();
	},
	formatValue: function() {
		// implement in subkind
	},
	handleChangeEvent: function(inSender, inEvent) {
		if (inEvent && inEvent.originator === this) {
			// Don't handle our own change events
			return;
		} else {
			this.updateValue(inSender, inEvent);
			return true;
		}
	},
	updateValue: function(inSender, inEvent) {
		// implement in subkind
	},
	valueChanged: function(inOld) {
		this.setChildPickers(inOld);
	},
	setChildPickers: function(inOld) {
		// implement in subkind
	},
	// If no item is selected, uses _this.noneText_ as current value.
	noneTextChanged: function() {
		if(this.value == null) {
			this.$.currentValue.setContent(this.getNoneText());
		} else {
			this.$.currentValue.setContent(this.formatValue());
{'fraction_non_alphanumeric': 0.11559872083382684, 'fraction_numerical': 0.0010659718109676656, 'mean_word_length': 3.7841359773371104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5690596', 'n_tokens_mistral': 2966, 'n_tokens_neox': 2647, 'n_words': 835}