mi6 / mi6/ic-ui-kit

IcChange event not emitted from date picker when date not within allowed range

Open
#3,275 1 comment 0 reactions 0 assignees View on GitHub
component: date time components
Dominant language
TypeScript
Stars
53
Forks
63
Avg merge
2d 4h
Merged PRs (30d)
15

Description

## Summary of the bug
On the date picker component, if you select a date which is not within the allowed range (i.e. when `max`, `min`, `disablePast` or `disableFuture` has been set), the icChange event is not emitted.

**Raised by a customer (split out from #3063)** - emitting icChange even when the date is not within the allowed range is needed for them as they want to validate the value themselves and update their custom validation message.

## 🪜 How to reproduce
1. Go to this [StackBlitz which shows three date pickers](https://stackblitz.com/edit/cxtjrwz1?file=src%2Fapp.tsx&hideExplorer=1) - the first uses `min` and `max`, the second `disablePast` and the third `disableFuture`.
2. Type in dates which are outside of the allowed range of dates.
3. See that icChange is not emitted (logged to the console). It is only emitted when the date is within the allowed range.

## 🧐 Expected behaviour
It would be useful if the icChange event gets emitted even when the date is not one which is allowed to accommodate for custom validation handling.

Note: icChange firing when invalid dates are chosen should be a prop that's disabled by default because it's only of benefit to users making external validation.

Contributor guide

Open the contributing guide

Research direction

Start with the date picker reproduction in the linked StackBlitz, using src/app.tsx and its console logging to confirm the current event behavior for min, max, disablePast, and disableFuture. Trace the date picker implementation and existing event tests, then ensure an opt-in prop can emit icChange for out-of-range dates while remaining disabled by default.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.