@@ -128,8 +128,6 @@ export class InputDatePicker
128
128
let newValueAsDate ;
129
129
if ( Array . isArray ( newValue ) ) {
130
130
newValueAsDate = getValueAsDateRange ( newValue ) ;
131
- this . start = newValue [ 0 ] ;
132
- this . end = newValue [ 1 ] ;
133
131
} else if ( newValue ) {
134
132
newValueAsDate = dateFromISO ( newValue ) ;
135
133
} else {
@@ -178,20 +176,6 @@ export class InputDatePicker
178
176
/** The component's value as a full date object. */
179
177
@Prop ( { mutable : true } ) valueAsDate : Date | Date [ ] ;
180
178
181
- /**
182
- * The component's start date as a full date object.
183
- *
184
- * @deprecated use `valueAsDate` instead.
185
- */
186
- @Prop ( { mutable : true } ) startAsDate : Date ;
187
-
188
- /**
189
- * The component's end date as a full date object.
190
- *
191
- * @deprecated use `valueAsDate` instead.
192
- */
193
- @Prop ( { mutable : true } ) endAsDate : Date ;
194
-
195
179
/** Specifies the earliest allowed date as a full date object. */
196
180
@Prop ( { mutable : true } ) minAsDate : Date ;
197
181
@@ -269,20 +253,6 @@ export class InputDatePicker
269
253
*/
270
254
@Prop ( { reflect : true } ) required = false ;
271
255
272
- /**
273
- * The component's start date.
274
- *
275
- * @deprecated use `value` instead.
276
- */
277
- @Prop ( { mutable : true , reflect : true } ) start : string ;
278
-
279
- /**
280
- * The component's end date.
281
- *
282
- * @deprecated use `value` instead.
283
- */
284
- @Prop ( { mutable : true , reflect : true } ) end : string ;
285
-
286
256
/**
287
257
* Determines the type of positioning to use for the overlaid content.
288
258
*
@@ -427,29 +397,17 @@ export class InputDatePicker
427
397
open && this . openHandler ( open ) ;
428
398
if ( Array . isArray ( this . value ) ) {
429
399
this . valueAsDate = getValueAsDateRange ( this . value ) ;
430
- this . start = this . value [ 0 ] ;
431
- this . end = this . value [ 1 ] ;
432
400
} else if ( this . value ) {
433
401
try {
434
402
this . valueAsDate = dateFromISO ( this . value ) ;
435
403
} catch ( error ) {
436
404
this . warnAboutInvalidValue ( this . value ) ;
437
405
this . value = "" ;
438
406
}
439
- this . start = "" ;
440
- this . end = "" ;
441
407
} else if ( this . range && this . valueAsDate ) {
442
408
this . setRangeValue ( this . valueAsDate as Date [ ] ) ;
443
409
}
444
410
445
- if ( this . start ) {
446
- this . startAsDate = dateFromISO ( this . start ) ;
447
- }
448
-
449
- if ( this . end ) {
450
- this . endAsDate = setEndOfDay ( dateFromISO ( this . end ) ) ;
451
- }
452
-
453
411
if ( this . min ) {
454
412
this . minAsDate = dateFromISO ( this . min ) ;
455
413
}
@@ -550,7 +508,6 @@ export class InputDatePicker
550
508
< calcite-date-picker
551
509
activeDate = { this . datePickerActiveDate }
552
510
activeRange = { this . focusedInput }
553
- endAsDate = { this . endAsDate }
554
511
headingLevel = { this . headingLevel }
555
512
max = { this . max }
556
513
maxAsDate = { this . maxAsDate }
@@ -563,7 +520,6 @@ export class InputDatePicker
563
520
proximitySelectionDisabled = { this . proximitySelectionDisabled }
564
521
range = { this . range }
565
522
scale = { this . scale }
566
- startAsDate = { this . startAsDate }
567
523
tabIndex = { 0 }
568
524
valueAsDate = { this . valueAsDate }
569
525
/>
@@ -809,16 +765,6 @@ export class InputDatePicker
809
765
this . setReferenceEl ( ) ;
810
766
} ;
811
767
812
- @Watch ( "start" )
813
- startWatcher ( start : string ) : void {
814
- this . startAsDate = dateFromISO ( start ) ;
815
- }
816
-
817
- @Watch ( "end" )
818
- endWatcher ( end : string ) : void {
819
- this . endAsDate = end ? setEndOfDay ( dateFromISO ( end ) ) : dateFromISO ( end ) ;
820
- }
821
-
822
768
@Watch ( "effectiveLocale" )
823
769
private async loadLocaleData ( ) : Promise < void > {
824
770
if ( ! Build . isBrowser ) {
@@ -849,21 +795,15 @@ export class InputDatePicker
849
795
} ;
850
796
851
797
private shouldFocusRangeStart ( ) : boolean {
852
- return ! ! (
853
- this . endAsDate &&
854
- ! this . startAsDate &&
855
- this . focusedInput === "end" &&
856
- this . startInput
857
- ) ;
798
+ const startValue = this . value [ 0 ] || undefined ;
799
+ const endValue = this . value [ 1 ] || undefined ;
800
+ return ! ! ( endValue && ! startValue && this . focusedInput === "end" && this . startInput ) ;
858
801
}
859
802
860
803
private shouldFocusRangeEnd ( ) : boolean {
861
- return ! ! (
862
- this . startAsDate &&
863
- ! this . endAsDate &&
864
- this . focusedInput === "start" &&
865
- this . endInput
866
- ) ;
804
+ const startValue = this . value [ 0 ] || undefined ;
805
+ const endValue = this . value [ 1 ] || undefined ;
806
+ return ! ! ( startValue && ! endValue && this . focusedInput === "start" && this . endInput ) ;
867
807
}
868
808
869
809
private handleDateRangeChange = ( event : CustomEvent < void > ) : void => {
@@ -887,12 +827,18 @@ export class InputDatePicker
887
827
888
828
private localizeInputValues ( ) : void {
889
829
const date = dateFromRange (
890
- this . range ? this . startAsDate : this . valueAsDate ,
830
+ ( this . range
831
+ ? ( Array . isArray ( this . valueAsDate ) && this . valueAsDate [ 0 ] ) || undefined
832
+ : this . valueAsDate ) as Date ,
891
833
this . minAsDate ,
892
834
this . maxAsDate
893
835
) ;
894
836
const endDate = this . range
895
- ? dateFromRange ( this . endAsDate , this . minAsDate , this . maxAsDate )
837
+ ? dateFromRange (
838
+ ( Array . isArray ( this . valueAsDate ) && this . valueAsDate [ 1 ] ) || undefined ,
839
+ this . minAsDate ,
840
+ this . maxAsDate
841
+ )
896
842
: null ;
897
843
898
844
const localizedDate =
@@ -935,8 +881,6 @@ export class InputDatePicker
935
881
this . userChangedValue = true ;
936
882
this . value = newValue ;
937
883
this . valueAsDate = newValue ? getValueAsDateRange ( newValue ) : undefined ;
938
- this . start = newStartDateISO ;
939
- this . end = newEndDateISO ;
940
884
941
885
const eventDetail = {
942
886
startDate : newStartDate as Date ,
0 commit comments