How to use the @ui5/webcomponents-base/dist/dates/CalendarDate.js.fromTimestamp function in @ui5/webcomponents-base

To help you get started, we’ve selected a few @ui5/webcomponents-base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / ui5-webcomponents / packages / main / src / DatePicker.js View on Github external
_handleCalendarSelectedDatesChange(event) {
		const iNewValue = event.detail.dates && event.detail.dates[0];

		if (this._calendar.selectedDates.indexOf(iNewValue) !== -1) {
			this.closePicker();
			return;
		}

		this.value = this.getFormat().format(
			new Date(CalendarDate.fromTimestamp(
				iNewValue * 1000,
				this._primaryCalendarType
			).valueOf()),
			true
		);
		this._calendar.timestamp = iNewValue;
		this._calendar.selectedDates = event.detail.dates;

		this._focusInputAfterClose = true;
		this.closePicker();

		this.fireEvent("change", { value: this.value, valid: true });
		// Angular two way data binding
		this.fireEvent("value-changed", { value: this.value, valid: true });
	}
github SAP / ui5-webcomponents / packages / main / src / YearPicker.js View on Github external
_handleSpace(event) {
		event.preventDefault();
		if (event.target.className.indexOf("ui5-yp-item") > -1) {
			const timestamp = this.getTimestampFromDom(event.target);

			this._selectedYear = CalendarDate.fromTimestamp(
				timestamp * 1000,
				this._primaryCalendarType
			).getYear();
		}
	}
github SAP / ui5-webcomponents / packages / main / src / Calendar.js View on Github external
_handleSelectedMonthChange(event) {
		const oNewDate = this._calendarDate;
		const newMonthIndex = CalendarDate.fromTimestamp(
			event.detail.timestamp * 1000,
			this._primaryCalendarType
		).getMonth();

		oNewDate.setMonth(newMonthIndex);
		this.timestamp = oNewDate.valueOf() / 1000;

		this._hideMonthPicker();

		this._focusFirstDayOfMonth(oNewDate);
	}
github SAP / ui5-webcomponents / packages / main / src / Calendar.js View on Github external
_isYearInRange(timestamp, yearsoffset, min, max) {
		if (timestamp) {
			const oCalDate = CalendarDate.fromTimestamp(timestamp * 1000, this._primaryCalendarType);
			oCalDate.setMonth(0);
			oCalDate.setDate(1);
			oCalDate.setYear(oCalDate.getYear() + yearsoffset);
			return oCalDate.getYear() >= min && oCalDate.getYear() <= max;
		}
	}
github SAP / ui5-webcomponents / packages / main / src / Calendar.js View on Github external
_handleSelectedYearChange(event) {
		const oOldMonth = this._calendarDate.getMonth();
		const oOldDay = this._calendarDate.getDate();
		const oNewDate = CalendarDate.fromTimestamp(
			event.detail.timestamp * 1000,
			this._primaryCalendarType
		);
		oNewDate.setMonth(oOldMonth);
		oNewDate.setDate(oOldDay);

		this.timestamp = oNewDate.valueOf() / 1000;

		this._hideYearPicker();

		this._focusFirstDayOfMonth(oNewDate);
	}
github SAP / ui5-webcomponents / packages / main / src / MonthPicker.js View on Github external
get _calendarDate() {
		return CalendarDate.fromTimestamp(this._localDate.getTime(), this._primaryCalendarType);
	}
github SAP / ui5-webcomponents / packages / main / src / DayPicker.js View on Github external
get _calendarDate() {
		return CalendarDate.fromTimestamp(this._localDate.getTime(), this._primaryCalendarType);
	}

@ui5/webcomponents-base

UI5 Web Components: webcomponents.base

Apache-2.0
Latest version published 5 days ago

Package Health Score

90 / 100
Full package analysis