@@ -84,11 +84,11 @@ class DateRangePicker extends DatePicker {
84
84
return [ DatePicker . styles , DateRangePickerCss ] ;
85
85
}
86
86
87
- get _firstDateTimestamp ( ) {
87
+ get _startDateTimestamp ( ) {
88
88
return this . _extractFirstTimestamp ( this . value ) ;
89
89
}
90
90
91
- get _lastDateTimestamp ( ) {
91
+ get _endDateTimestamp ( ) {
92
92
return this . _extractLastTimestamp ( this . value ) ;
93
93
}
94
94
@@ -109,7 +109,7 @@ class DateRangePicker extends DatePicker {
109
109
* @override
110
110
*/
111
111
get _calendarTimestamp ( ) {
112
- return this . _tempTimestamp || this . _firstDateTimestamp || getTodayUTCTimestamp ( this . _primaryCalendarType ) ;
112
+ return this . _tempTimestamp || this . _startDateTimestamp || getTodayUTCTimestamp ( this . _primaryCalendarType ) ;
113
113
}
114
114
115
115
/**
@@ -127,25 +127,25 @@ class DateRangePicker extends DatePicker {
127
127
}
128
128
129
129
/**
130
- * Currently selected first date represented as JavaScript Date instance.
130
+ * Returns the start date of the currently selected range as JavaScript Date instance.
131
131
*
132
132
* @readonly
133
133
* @type { Date }
134
134
* @public
135
135
*/
136
- get firstDateValue ( ) {
137
- return CalendarDate . fromTimestamp ( this . _firstDateTimestamp * 1000 ) . toLocalJSDate ( ) ;
136
+ get startDateValue ( ) {
137
+ return CalendarDate . fromTimestamp ( this . _startDateTimestamp * 1000 ) . toLocalJSDate ( ) ;
138
138
}
139
139
140
140
/**
141
- * Currently selected last date represented as JavaScript Date instance.
141
+ * Returns the end date of the currently selected range as JavaScript Date instance.
142
142
*
143
143
* @readonly
144
144
* @type { Date }
145
145
* @public
146
146
*/
147
- get lastDateValue ( ) {
148
- return CalendarDate . fromTimestamp ( this . _lastDateTimestamp * 1000 ) . toLocalJSDate ( ) ;
147
+ get endDateValue ( ) {
148
+ return CalendarDate . fromTimestamp ( this . _endDateTimestamp * 1000 ) . toLocalJSDate ( ) ;
149
149
}
150
150
151
151
/**
@@ -231,7 +231,7 @@ class DateRangePicker extends DatePicker {
231
231
* @override
232
232
*/
233
233
async _modifyDateValue ( amount , unit ) {
234
- if ( ! this . _lastDateTimestamp ) { // If empty or only one date -> treat as datepicker entirely
234
+ if ( ! this . _endDateTimestamp ) { // If empty or only one date -> treat as datepicker entirely
235
235
return super . _modifyDateValue ( amount , unit ) ;
236
236
}
237
237
@@ -240,17 +240,17 @@ class DateRangePicker extends DatePicker {
240
240
let newValue ;
241
241
242
242
if ( caretPos <= this . value . indexOf ( this . _effectiveDelimiter ) ) { // The user is focusing the first date -> change it and keep the seoond date
243
- const firstDateModified = modifyDateBy ( CalendarDate . fromTimestamp ( this . _firstDateTimestamp * 1000 ) , amount , unit , this . _minDate , this . _maxDate ) ;
244
- const newFirstDateTimestamp = firstDateModified . valueOf ( ) / 1000 ;
245
- if ( newFirstDateTimestamp > this . _lastDateTimestamp ) { // dates flipped -> move the caret to the same position but on the last date
243
+ const startDateModified = modifyDateBy ( CalendarDate . fromTimestamp ( this . _startDateTimestamp * 1000 ) , amount , unit , this . _minDate , this . _maxDate ) ;
244
+ const newStartDateTimestamp = startDateModified . valueOf ( ) / 1000 ;
245
+ if ( newStartDateTimestamp > this . _endDateTimestamp ) { // dates flipped -> move the caret to the same position but on the last date
246
246
caretPos += Math . ceil ( this . value . length / 2 ) ;
247
247
}
248
- newValue = this . _buildValue ( newFirstDateTimestamp , this . _lastDateTimestamp ) ; // the value will be normalized so we don't try to order them here
248
+ newValue = this . _buildValue ( newStartDateTimestamp , this . _endDateTimestamp ) ; // the value will be normalized so we don't try to order them here
249
249
} else {
250
- const lastDateModified = modifyDateBy ( CalendarDate . fromTimestamp ( this . _lastDateTimestamp * 1000 ) , amount , unit , this . _minDate , this . _maxDate ) ;
251
- const newLastDateTimestamp = lastDateModified . valueOf ( ) / 1000 ;
252
- newValue = this . _buildValue ( this . _firstDateTimestamp , newLastDateTimestamp ) ; // the value will be normalized so we don't try to order them here
253
- if ( newLastDateTimestamp < this . _firstDateTimestamp ) { // dates flipped -> move the caret to the same position but on the first date
250
+ const endDateModified = modifyDateBy ( CalendarDate . fromTimestamp ( this . _endDateTimestamp * 1000 ) , amount , unit , this . _minDate , this . _maxDate ) ;
251
+ const newEndDateTimestamp = endDateModified . valueOf ( ) / 1000 ;
252
+ newValue = this . _buildValue ( this . _startDateTimestamp , newEndDateTimestamp ) ; // the value will be normalized so we don't try to order them here
253
+ if ( newEndDateTimestamp < this . _startDateTimestamp ) { // dates flipped -> move the caret to the same position but on the first date
254
254
caretPos -= Math . ceil ( this . value . length / 2 ) ;
255
255
}
256
256
}
0 commit comments