<commit_before>/*!
 * ${copyright}
 */

// Provides class sap.ui.unified.calendar.CustomYearPicker
sap.ui.define([
	"sap/ui/core/Renderer",
	"sap/ui/unified/Calendar",
	"sap/ui/unified/CalendarRenderer",
	"sap/ui/unified/calendar/CalendarDate",
	"sap/ui/unified/calendar/Header",
	"sap/ui/unified/DateRange"
],
	function(
		Renderer,
		Calendar,
		CalendarRenderer,
		CalendarDate,
		Header,
		DateRange
	) {
	"use strict";

	var CustomYearPickerRenderer = Renderer.extend(CalendarRenderer);
	CustomYearPickerRenderer.apiVersion = 2;

	var CustomYearPicker = Calendar.extend("sap.ui.unified.internal.CustomYearPicker", {
		metadata: {
			library: "sap.ui.unified"
		},
		renderer: CustomYearPickerRenderer
	});

	/*
	 * Possible values for the "_currentPicker" aggregation: yearPicker.
	 */

	CustomYearPicker.prototype.init = function(){
		Calendar.prototype.init.apply(this, arguments);
		this.setProperty("_currentPicker", "yearPicker");
		this._bNamesLengthChecked = true;
	};

	CustomYearPicker.prototype.onBeforeRendering = function () {
		var oFirstCYPSelDate = this.getSelectedDates()[0],
			oFocusedCalDate = new CalendarDate(this._getFocusedDate()),
			oYearPicker = this._getYearPicker(),
			oCYPSelCalDate;

		oFocusedCalDate.setMonth(0, 1);

		if (oFirstCYPSelDate.getStartDate()) {
			oCYPSelCalDate = CalendarDate.fromLocalJSDate(oFirstCYPSelDate.getStartDate());
			oCYPSelCalDate.setMonth(0, 1);

			if (oFocusedCalDate.isSame(oCYPSelCalDate)) {
				oYearPicker.setDate(oFirstCYPSelDate.getStartDate());
			}
		} else {
			oYearPicker.setProperty("_middleDate", this._getFocusedDate());
		}

		Calendar.prototype.onBeforeRendering.call(this, arguments);
	};
<commit_msg>[INTERNAL] sap.ui.unified.calendar.CustomYearPicker: duplicate id tests now run successfully<commit_after>/*!
 * ${copyright}
 */

// Provides class sap.ui.unified.calendar.CustomYearPicker
sap.ui.define([
	"sap/ui/core/Renderer",
	"sap/ui/unified/Calendar",
	"sap/ui/unified/CalendarRenderer",
	"sap/ui/unified/calendar/CalendarDate",
	"sap/ui/unified/calendar/Header",
	"sap/ui/unified/DateRange"
],
	function(
		Renderer,
		Calendar,
		CalendarRenderer,
		CalendarDate,
		Header,
		DateRange
	) {
	"use strict";

	var CustomYearPickerRenderer = Renderer.extend(CalendarRenderer);
	CustomYearPickerRenderer.apiVersion = 2;

	var CustomYearPicker = Calendar.extend("sap.ui.unified.internal.CustomYearPicker", {
		metadata: {
			library: "sap.ui.unified"
		},
		renderer: CustomYearPickerRenderer
	});

	/*
	 * Possible values for the "_currentPicker" aggregation: yearPicker.
	 */

	CustomYearPicker.prototype.init = function(){
		Calendar.prototype.init.apply(this, arguments);
		this.setProperty("_currentPicker", "yearPicker");
		this._bNamesLengthChecked = true;
	};

	CustomYearPicker.prototype.onBeforeRendering = function () {
		var aSelectedDates = this.getSelectedDates(),
			oFirstSelectedDate = aSelectedDates.length ? aSelectedDates[0].getStartDate() : undefined,
			oYearPicker = this._getYearPicker(),
			oCYPSelCalDate,
			oFocusedCalDate;

		if (oFirstSelectedDate) {
			oCYPSelCalDate = CalendarDate.fromLocalJSDate(oFirstSelectedDate);
			oCYPSelCalDate.setMonth(0, 1);
			oFocusedCalDate = new CalendarDate(this._getFocusedDate());
			oFocusedCalDate.setMonth(0, 1);

			if (oFocusedCalDate.isSame(oCYPSelCalDate)) {
				oYearPicker.setDate(oFirstSelectedDate);
			}
		} else {
			oYearPicker.setProperty("_middleDate", this._getFocusedDate());
		}

		Calendar.prototype.onBeforeRendering.call(this, arguments);
	};

{'fraction_non_alphanumeric': 0.13028668748225944, 'fraction_numerical': 0.0034061879080329264, 'mean_word_length': 5.086355785837651, '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': '2892689', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1183, 'n_words': 164}