Skip to content

Commit

Permalink
refactor(date-picker)!: Removing deprecated end property #5798
Browse files Browse the repository at this point in the history
  • Loading branch information
eriklharper committed Dec 13, 2022
1 parent d3707d1 commit 018d1e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
14 changes: 2 additions & 12 deletions src/components/date-picker/date-picker.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ const createAttributes: (options?: { exceptions: string[] }) => Attributes = ({
return this;
}
},
{
name: "end",
commit(): Attribute {
this.value = text("end", "");
delete this.build;
return this;
}
},
{
name: "intl-next-month",
commit(): Attribute {
Expand Down Expand Up @@ -138,8 +130,7 @@ export const range = (): string =>
html`<div style="width: 400px">
${create(
"calcite-date-picker",
createAttributes({ exceptions: ["end", "min", "range"] }).concat([
{ name: "end", value: "2020-02-16" },
createAttributes({ exceptions: ["min", "range"] }).concat([
{ name: "min", value: "2016-08-09" },
{ name: "range", value: "true" }
])
Expand All @@ -150,9 +141,8 @@ export const rangeRTL_TestOnly = (): string =>
html`<div style="width: 400px">
${create(
"calcite-date-picker",
createAttributes({ exceptions: ["end", "min", "range", "dir"] }).concat([
createAttributes({ exceptions: ["min", "range", "dir"] }).concat([
{ name: "dir", value: "rtl" },
{ name: "end", value: "2020-02-16" },
{ name: "min", value: "2016-08-09" },
{ name: "range", value: "true" }
])
Expand Down
20 changes: 0 additions & 20 deletions src/components/date-picker/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ export class DatePicker implements LocalizedComponent {
/** When `true`, activates the component's range mode to allow a start and end date. */
@Prop({ reflect: true }) range = false;

/**
* Specifies the selected end date.
*
* @deprecated use `value` instead.
*/
@Prop({ mutable: true, reflect: true }) end: string;

/** When `true`, disables the default behavior on the third click of narrowing or extending the range and instead starts a new range. */
@Prop({ reflect: true }) proximitySelectionDisabled = false;

Expand Down Expand Up @@ -218,15 +211,10 @@ export class DatePicker implements LocalizedComponent {

if (Array.isArray(this.value)) {
this.valueAsDate = getValueAsDateRange(this.value);
this.end = this.value[1];
} else if (this.value) {
this.valueAsDate = dateFromISO(this.value);
}

if (this.end) {
this.setEndAsDate(dateFromISO(this.end));
}

if (this.min) {
this.minAsDate = dateFromISO(this.min);
}
Expand Down Expand Up @@ -319,18 +307,11 @@ export class DatePicker implements LocalizedComponent {
valueHandler(value: string | string[]): void {
if (Array.isArray(value)) {
this.valueAsDate = getValueAsDateRange(value);
this.end = value[1];
} else if (value) {
this.valueAsDate = dateFromISO(value);
this.end = "";
}
}

@Watch("end")
endWatcher(end: string): void {
this.setEndAsDate(dateFromISO(end));
}

@Watch("effectiveLocale")
private async loadLocaleData(): Promise<void> {
if (!Build.isBrowser) {
Expand Down Expand Up @@ -543,7 +524,6 @@ export class DatePicker implements LocalizedComponent {
};

private setEndDate(date: Date): void {
this.end = date ? dateToISO(date) : "";
this.setEndAsDate(date, true);
this.activeEndDate = date || null;
}
Expand Down

0 comments on commit 018d1e7

Please sign in to comment.