Skip to content

Commit 4c11286

Browse files
feat(ui5-daterange-picker): initial implementation (#1785)
1 parent 77e8886 commit 4c11286

11 files changed

+677
-7
lines changed

packages/main/bundle.esm.js

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import Carousel from "./dist/Carousel.js";
4040
import CheckBox from "./dist/CheckBox.js";
4141
import ComboBox from "./dist/ComboBox.js";
4242
import DatePicker from "./dist/DatePicker.js";
43+
import DateRangePicker from "./dist/DateRangePicker.js";
4344
import DateTimePicker from "./dist/DateTimePicker.js";
4445
import DurationPicker from "./dist/DurationPicker.js";
4546
import Dialog from "./dist/Dialog.js";

packages/main/src/DatePicker.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ class DatePicker extends UI5Element {
401401
this.maxDate = null;
402402
console.warn(`In order for the "maxDate" property to have effect, you should enter valid date format`); // eslint-disable-line
403403
}
404-
if (this.isValid(this.value) && this.isInValidRange(this._getTimeStampFromString(this.value))) {
404+
if (this._checkValueValidity(this.value)) {
405405
this._changeCalendarSelection();
406406
} else {
407407
this._calendar.selectedDates = [];
@@ -462,10 +462,9 @@ class DatePicker extends UI5Element {
462462
_handleInputChange() {
463463
let nextValue = this._getInput().getInputValue();
464464
const emptyValue = nextValue === "";
465-
const isValid = emptyValue || this.isValid(nextValue);
466-
const isInValidRange = this.isInValidRange(this._getTimeStampFromString(nextValue));
465+
const isValid = emptyValue || this._checkValueValidity(nextValue);
467466

468-
if (isValid && isInValidRange) {
467+
if (isValid) {
469468
nextValue = this.normalizeValue(nextValue);
470469
this.valueState = ValueState.None;
471470
} else {
@@ -482,12 +481,16 @@ class DatePicker extends UI5Element {
482481
_handleInputLiveChange() {
483482
const nextValue = this._getInput().getInputValue();
484483
const emptyValue = nextValue === "";
485-
const isValid = emptyValue || (this.isValid(nextValue) && this.isInValidRange(this._getTimeStampFromString(nextValue)));
484+
const isValid = emptyValue || this._checkValueValidity(nextValue);
486485

487486
this.value = nextValue;
488487
this.fireEvent("input", { value: nextValue, valid: isValid });
489488
}
490489

490+
_checkValueValidity(value) {
491+
return this.isValid(value) && this.isInValidRange(this._getTimeStampFromString(value));
492+
}
493+
491494
_click(event) {
492495
if (isPhone()) {
493496
this.responsivePopover.open(this);

packages/main/src/DateRangePicker.hbs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{>include "./DatePicker.hbs"}}

0 commit comments

Comments
 (0)