Skip to content

datepicker: Add support for passing IOS8601 strings to datepicker regardless of the DateAdapter #6265

Closed
@mahmood-sajjadi

Description

@mahmood-sajjadi

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Initial value in text field is empty string and Date picket required an input text field which means should accept empty string as not defined value, or is user want to remove value, should be able to remove text field value

What is the current behavior?

in master code
in this PR : 8bb54ca
in this file:
https://github.com/angular/material2/blob/master/src/lib/datepicker/datepicker-input.ts#L119

an empty string is not an acceptable value and it is raising the following error:
Datepicker: value not recognized as a date object by DateAdapter.

What are the steps to reproduce?

Just add
formControlName="birthdate"
to input field in datepicker and sround it by formGroup

this is plunker example:
http://plnkr.co/edit/bhswcOgSB36yqD6Yr8nF?p=preview

please open chrome console to see the warning an error

What is the use-case or motivation for changing an existing behavior?

Using datepicker in form group

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

angular 4.3.2
material 2.0.0-beta.8-5967f6e

Is there anything else we should know?

It was working fine before that PR becuse the condition was
if (!value)
which is working as expected with empty string

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions