Skip to content

Not clear how/when DateAdapter parse is called #6335

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

Closed
james-schwartzkopf opened this issue Aug 7, 2017 · 2 comments
Closed

Not clear how/when DateAdapter parse is called #6335

james-schwartzkopf opened this issue Aug 7, 2017 · 2 comments
Assignees

Comments

@james-schwartzkopf
Copy link

Looking through master I can tell some changes have been made since beta-8, but it's still not clear when/how DateAdapter parse is called.

As far as I can tell after the new changes parse is only called with string values from the input element, but it's still defined as abstract parse(value: any, parseFormat: any): D | null;, and unit test are still passing it numbers and Date objects.

In beta-8 parse was getting called with model values that were set on the input. This made it difficult to implement DateAdapter<string> since I couldn't tell which strings were from the model (expected to be in ISO 8601 format), and those from the user (expected to be in a format like MM-DD-YYYY).

I'm hoping the changes mean parse will only ever be called with a formatted string from the input or similar, but can't tell from the current docs/interface.

@mmalerba
Copy link
Contributor

mmalerba commented Sep 8, 2017

As of beta 10 the datepicker will only call parse on a string. However we do intend for developers to be able to inject the DateAdapter into their own components that need to work with dates if they want, and as a convenience we allow any type to be passed to parse.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants