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

Cannot select a month with less days than the current day of the month #6180

Closed
lvaskys opened this issue Jul 31, 2017 · 2 comments
Closed

Comments

@lvaskys
Copy link

lvaskys commented Jul 31, 2017

Bug, feature request, or proposal:

In the datepicker, when selecting a month using the month picker area, selecting a month with less days than the current day of the month will cause an error to be thrown and the given month will not appear in the datepicker.

What is the expected behavior?

The given month will pop up and allow the user to pick a date within that month.

What is the current behavior?

An error is thrown, and the month does not display and remains on the month picker screen.

Error: Invalid date "31" for month with index "1".
at NativeDateAdapter.Array.concat.NativeDateAdapter.createDate (material.es5.js:4368)
at MdYearView.Array.concat.MdYearView._monthSelected (material.es5.js:19128)
at Object.eval [as handleEvent] (MdYearView.ngfactory.js:19)
at Object.handleEvent (core.es5.js:11997)
at Object.handleEvent (core.es5.js:12721)
at dispatchEvent (core.es5.js:8601)
at core.es5.js:10763
at SafeSubscriber.schedulerFn [as _next] (core.es5.js:3647)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:238)
at SafeSubscriber.next (Subscriber.js:185)

What are the steps to reproduce?

Requirements: Today must be a day of the month where there exists a month with less than the current day's number of days. For example, today (7/31/2017), this error appeared because a user wanted to pick February, but could not because February doesn't have 31 days.

https://plnkr.co/edit/WzKAavdmSbLkOLzyqtcc?p=preview

  1. Open the date picker
  2. Select the Month-Year in order to get to the month picker.
  3. Select February. An error is thrown and the datepicker screen stays the same.

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

Some users like to use the month-picker rather than scrolling through the months using the left and right carrots and should be able to do so.

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

Angular 4.1.3
Material 2.0.0-beta.8
OS Windows 10
Typescript 2.3.2

Is there anything else we should know?

@donroyco
Copy link
Contributor

donroyco commented Aug 1, 2017

Please use the search function before reporting a issue. Already reported in #6092 and a fix is in commit #6129

@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 6, 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

3 participants