Skip to content

Commit

Permalink
fix: make mode dynamically changeable for datepicker (#468)
Browse files Browse the repository at this point in the history
fix: make mode dynamically changeable for datepicker (#468)
  • Loading branch information
TimSielemann authored Mar 1, 2024
1 parent 5726692 commit d17d28a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions angular/projects/catalyst-demo/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ <h2>Form Components</h2>
></cat-select>
<!-- Datepicker Section 1 -->
<cat-checkbox #checkBox
label="Should disable next datepicker">
label="Should toggle between date and datetime">
</cat-checkbox>
<cat-datepicker
[disabled]="checkBox.checked"
[mode]="checkBox.checked ? 'date' : 'datetime'"
label="Datepicker"
[nativeAttributes]="{ 'data-test': 'test-attribute' }"
hint="Depends on [disabled] attribute"
Expand Down
3 changes: 2 additions & 1 deletion core/src/components/cat-datepicker/cat-datepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ export class CatDatepickerFlat {

@Watch('disabled')
@Watch('readonly')
@Watch('mode')
onDisabledChanged() {
// Dynamically changing 'disabled' value is not working due to a bug in the
// Dynamically changing config value is not working due to a bug in the
// library. We thus need to fully recreate the date picker after the value
// has been updated.
this.pickr?.destroy();
Expand Down

0 comments on commit d17d28a

Please sign in to comment.