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

igx-timepicker model is not cleared when value in the input is cleared #6585

Closed
sjPrajwal opened this issue Feb 3, 2020 · 21 comments
Closed
Assignees
Labels
🐛 bug Any issue that describes a bug 🕐 time-picker 🔥 severity: high status: not-a-bug version: 8.2.x version: 9.0.x version: 9.1.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.

Comments

@sjPrajwal
Copy link

timepicker works with angular form?

need to integrate the dropdown time picker with angular forms and do validation with reactive form validation.

Describe the solution you'd like

time picker can integrate to a angular with template reference variable, instead of component directive.

@Lipata
Copy link
Member

Lipata commented Feb 3, 2020

Hi, @sjPrajwal.

Did you had the chance to check the already existing igxTimePicker?

@sjPrajwal
Copy link
Author

sjPrajwal commented Feb 3, 2020 via email

@sjPrajwal
Copy link
Author

Hi @Lipata ,

You got the problem am facing..??
Please suggest any solution..

@zdrawku
Copy link
Contributor

zdrawku commented Feb 3, 2020

For proper ngModel binding in a form a name attribute needs to be specified for the input you're using or provide [ngModelOptions]={standalone: true}

@sjPrajwal
Copy link
Author

Hi @Lipata,

<igx-time-picker format="HH:mm" formControlName="endTime" [minValue]="min" [maxValue]="max" mode="dropdown"
[(ngModel)]="enquiry.endTime">

this is how i am using in application, once the value set, again if i need to clear the by editing feild or by using X mark, ngModel still show the Mon Feb 03 2020 00:00:00 GMT+0530 (India Standard Time) time.

@zdrawku
Copy link
Contributor

zdrawku commented Feb 3, 2020

Change your code to:

<igx-time-picker format="HH:mm" formControlName="endTime" [minValue]="min" [maxValue]="max" mode="dropdown" name="test"
[(ngModel)]="enquiry.endTime">

You can use this sample as a reference

@sjPrajwal
Copy link
Author

sjPrajwal commented Feb 4, 2020 via email

@sjPrajwal
Copy link
Author

sjPrajwal commented Feb 4, 2020 via email

@sjPrajwal
Copy link
Author

Hi @Lipata,

Any updates regarding this feature??

@wnvko
Copy link
Contributor

wnvko commented Feb 13, 2020

@sjPrajwal to bind input to ngModel the input should have either name attribute set or [ngModelOptions]="{standalone: true}. Both ways this is working in your last sample.

@sjPrajwal
Copy link
Author

Hi @wnvko,

i think you didn't get the question i asked, from time-picker value is binding to the ng-model, but its not clearing.
Means:
1). if you try to clear values in input field of picker editing that, only from picker its clearing not from ng-model, still ng-model holding same values or 00:00 value.
2). if try to clear values using X mark in picker, still observing same behavior as above.

Instead for assigning this to feature-request we can tell its a bug in time-picker.
for date picker its working perfectly fine, please test both date-picker and time-picker of below sample.
https://stackblitz.com/edit/angular-ngmodel-form-datepicker-rsqpsl?file=src/app/scheduling/datepicker/datepicker-dropdown/datepicker-dropdown.component.html

i was not able attached the screen shots, otherwise i would have attached the screen shots for better understanding.

Thanks.
Waiting for your reply.

@Lipata
Copy link
Member

Lipata commented Feb 14, 2020

@sjPrajwal, you are correct this is a bug in the time-picker

@Lipata Lipata changed the title igx-timepicker supporting for angular igx-timepicker model is not cleared when value in the input is cleared Feb 14, 2020
@sjPrajwal
Copy link
Author

Hi @Lipata,

When can i expect fix for this bug ?

@Lipata
Copy link
Member

Lipata commented Feb 17, 2020

@sjPrajwal, we can start working on this bug, as early as next week.

@sjPrajwal
Copy link
Author

@Lipata,
Good morning.
Any updates on the issue.?

@Lipata
Copy link
Member

Lipata commented Feb 26, 2020

Hi, @sjPrajwal. Still not started working on it. I will keep you updated when we have the time to work on this issue.

@sjPrajwal
Copy link
Author

Okay @Lipata,

Thanks.

@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label May 10, 2020
@PlamenaMiteva PlamenaMiteva added 🛠️ status: in-development Issues and PRs with active development on them and removed 🆕 status: new labels May 13, 2020
@PlamenaMiteva
Copy link
Contributor

Hi @sjPrajwal,

Since the time picker component is designed to work with the date picker, the clear() method does not set its value to null, it sets the hours and minutes to zero instead. However we are planning to refactor both time and date picker components very soon and I have already linked this issue to the time picker refactoring issue.
Meanwhile, a possible workaround would be to handle the valueChange event and set the value to null if it has been cleared as in the following sample

@PlamenaMiteva PlamenaMiteva added status: not-a-bug ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. and removed 🛠️ status: in-development Issues and PRs with active development on them labels May 15, 2020
@Lipata Lipata closed this as completed May 15, 2020
@Lipata Lipata removed the status: inactive Used to stale issues and pull requests label May 18, 2020
@ammar4568
Copy link

Hi @PlamenaMiteva @Lipata @sjPrajwal any update on this? Still looking for a way to clear input to null on clear icon or back key press.

@PlamenaMiteva
Copy link
Contributor

Hi @ammar4568,

The time picker can be bound to either a Date object or time-only string value in ISO 8601 format. The clear icon clears the time picker value if it is a string or resets the time to '00:00:00' if the value is a Date object.
So, what you want to achieve can be done by binding the time picker to a string value in ISO 8601 format. You can read more about time picker binding in our documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Any issue that describes a bug 🕐 time-picker 🔥 severity: high status: not-a-bug version: 8.2.x version: 9.0.x version: 9.1.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.
Projects
None yet
Development

No branches or pull requests

6 participants