From 083fe48ea59020bb0cb110c7e9834e9738c26539 Mon Sep 17 00:00:00 2001 From: "alen.a.popova" Date: Thu, 6 Jun 2024 18:34:53 +0400 Subject: [PATCH 1/2] fix(kit): fix InputDateTime format textfield value on blur --- .../kit/components/input-date-time/input-date-time.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/kit/components/input-date-time/input-date-time.component.ts b/projects/kit/components/input-date-time/input-date-time.component.ts index 3d0667c3f9ce..54fffeb2eb25 100644 --- a/projects/kit/components/input-date-time/input-date-time.component.ts +++ b/projects/kit/components/input-date-time/input-date-time.component.ts @@ -312,7 +312,7 @@ export class TuiInputDateTimeComponent if ( this.value[0] === null || this.value[1] !== null || - this.nativeValue.length <= this.fillerLength + DATE_TIME_SEPARATOR.length || + this.nativeValue.length === this.fillerLength || this.timeMode === 'HH:MM' ) { return; From 49b95bcccd2d3c2c5e0de257ba4dd57edbfac333 Mon Sep 17 00:00:00 2001 From: "alen.a.popova" Date: Fri, 7 Jun 2024 13:00:52 +0400 Subject: [PATCH 2/2] fix(kit): add test --- .../tests/kit/input-date-time/input-date-time.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/demo-playwright/tests/kit/input-date-time/input-date-time.spec.ts b/projects/demo-playwright/tests/kit/input-date-time/input-date-time.spec.ts index 9c9ffbed52f6..606277db162b 100644 --- a/projects/demo-playwright/tests/kit/input-date-time/input-date-time.spec.ts +++ b/projects/demo-playwright/tests/kit/input-date-time/input-date-time.spec.ts @@ -149,6 +149,15 @@ describe('InputDateTime', () => { '15.11.2018, '.length, ); }); + + test('should time to pre-fill with zeros on blur', async ({page}) => { + await tuiGoto(page, '/components/input-date-time/API?timeMode=HH:MM:SS.MSS'); + + await inputDateTime.textfield.fill('07.06.2024, 23:59'); + await inputDateTime.textfield.blur(); + + await expect(inputDateTime.textfield).toHaveValue('07.06.2024, 23:59:00.000'); + }); }); describe('invalid date', () => {