Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimePicker optional default value conflicts with initial value implementation #21824

Closed
ivi-hamiti opened this issue Feb 21, 2022 · 1 comment
Assignees
Labels
Component: TimePicker Resolution: Soft Close Soft closing inactive issues over a certain period Type: Bug 🐛

Comments

@ivi-hamiti
Copy link

Environment Information

  • Package version(s): 8.55.3
  • Browser and OS versions: Edge 98.0.1108.56, Win 11

Describe the issue:

Per implementation the TimePicker initial value will default to either the provided defaultValue prop or it will automatically set to the current date time. This makes it impossible to provide a time input for an optional field as it will always be providing a value.

// Code from /packages/react/src/components/TimePicker/TimePicker.tsx
....
const optionsCount = getDropdownOptionsCount(increments, timeRange);

const initialValue = useConst(defaultValue || new Date());
const baseDate: Date = React.useMemo(() => generateBaseDate(increments, timeRange, initialValue), [
  increments,
  timeRange,
  initialValue,
]);
....

Actual behavior:

Even when no defaultValue set initial value is set to now

Expected behavior:

When no defaultValue provided the component should not have any value

Documentation describing expected behavior

Provide a solution by changing the api to support optional value for the input

@msft-fluent-ui-bot
Copy link
Collaborator

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@msft-fluent-ui-bot msft-fluent-ui-bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Jul 26, 2022
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: TimePicker Resolution: Soft Close Soft closing inactive issues over a certain period Type: Bug 🐛
Projects
None yet
Development

No branches or pull requests

3 participants