Skip to content

Commit

Permalink
fix for facet date input reset
Browse files Browse the repository at this point in the history
  • Loading branch information
fpbrault committed Jul 30, 2024
1 parent 792ad91 commit 0fae3c7
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ export class FacetDateInput {
this.start = range ? parseDate(range.start).toDate() : undefined;
this.end = range ? parseDate(range.end).toDate() : undefined;
}
public componentDidUpdate() {
if (!this.startRef.value && !this.endRef.value) {
this.startRef.min = this.min || this.formattedDateValue('1401-01-01');
this.endRef.max = this.max || '';
this.startRef.max = this.max || '';
this.endRef.min = this.min || '';
}
}

private apply() {
if (!this.startRef.validity.valid || !this.endRef.validity.valid) {
Expand Down Expand Up @@ -138,7 +146,7 @@ export class FacetDateInput {
placeholder={placeholder}
pattern={pattern}
required
min={this.min || this.formattedDateValue(this.start)}
min={this.formattedDateValue(this.start) || this.min}
max={this.max}
value={this.formattedDateValue(range?.end)}
onInput={(e) =>
Expand Down

0 comments on commit 0fae3c7

Please sign in to comment.