material icon indicating copy to clipboard operation
material copied to clipboard

datePicker: model isn't updated until 500ms has passed since the last edit

Open mkowalchuk opened this issue 10 years ago • 1 comments

Actual Behavior:

  • What is the issue? *

My setup: I have a datePicker in a dialog, and when the dialog closes, I try to submit the data from the datePicker to my server.

If a user enters data into the datePicker and closes the dialog in less than 500ms, stale or otherwise invalid data gets sent to the server, because datePicker hasn't updated my model.

The general problem, I think, is that the debouncing in datePicker is too aggressive, and the datePicker component provides no way to force it to sync with the model. You're just stuck waiting for 500ms.

  • What is the expected behavior?

I think it's reasonable to sync to the model on blur, because the blur event is a good indication that the user has finished entering data into the input field.

CodePen (or steps to reproduce the issue): *

  • CodePen Demo which shows your issue:
  • Details:

You can see the impact of the 500ms delay on the Datepicker demo at https://material.angularjs.org/latest/demo/datepicker :

  1. Put your cursor in the textbox under "Standard date-picker"
  2. Quickly enter a new date and press tab
  3. Note that it takes 500ms before the other date pickers are synced with the first one

Angular Versions: *

  • Angular Version: 1.5
  • Angular Material Version: Noted on 1.0.9

Additional Information:

  • Browser Type: * Chrome
  • Browser Version: * 51.0.2704.106 (64-bit)
  • OS: * Ubuntu
  • Stack Traces: N/A

mkowalchuk avatar Jun 29 '16 23:06 mkowalchuk

We've already had it in mind to be able to reduce the debounce interval (https://github.com/angular/material/issues/8450). I'll continue tracking it here.

crisbeto avatar Jun 30 '16 07:06 crisbeto