From 20e99125dba0f7ebf423fcd4413eeaafc2ec36aa Mon Sep 17 00:00:00 2001 From: Nikita Barsukov Date: Tue, 15 Oct 2024 10:29:00 +0300 Subject: [PATCH] fix(addon-mobile): `InputDateRange` + `MobileCalendar` throw error on single date selection --- .../mobile-calendar-dropdown.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/addon-mobile/components/mobile-calendar-dialog/mobile-calendar-dropdown.component.ts b/projects/addon-mobile/components/mobile-calendar-dialog/mobile-calendar-dropdown.component.ts index 8848c8283e41..aa8b6a5d5b5e 100644 --- a/projects/addon-mobile/components/mobile-calendar-dialog/mobile-calendar-dropdown.component.ts +++ b/projects/addon-mobile/components/mobile-calendar-dialog/mobile-calendar-dropdown.component.ts @@ -11,6 +11,8 @@ import { TUI_FIRST_DAY, TUI_LAST_DAY, TuiActiveZoneDirective, + TuiDay, + TuiDayRange, } from '@taiga-ui/cdk'; import { TUI_ANIMATIONS_DURATION, @@ -96,11 +98,14 @@ export class TuiMobileCalendarDropdownComponent { this.keyboard.show(); } - confirm(value: any): void { + confirm(value: TuiDay | TuiDayRange | readonly TuiDay[] | null): void { const control = this.single || this.multi || this.range; if (control) { - control.value = value; + control.value = + this.range && value instanceof TuiDay + ? new TuiDayRange(value, value) + : value; } this.close();