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

Make year selectable in date picker #5845

Closed
mschering opened this issue Jul 18, 2017 · 35 comments · Fixed by #8565
Closed

Make year selectable in date picker #5845

mschering opened this issue Jul 18, 2017 · 35 comments · Fixed by #8565
Assignees
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful
Milestone

Comments

@mschering
Copy link

mschering commented Jul 18, 2017

Bug, feature request, or proposal:

feature request

What is the expected behavior?

The year should be selectable from a dropdown list.

What is the current behavior?

The year can only be changed with the previous and next button.

What are the steps to reproduce?

See demo: https://material.angular.io/components/datepicker/examples

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

Entering birthdays is very cumbersome. You have to click previous a lot for old people :)

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

Material 2.0

@naveedahmed1
Copy link

I also think that there are serious usability issues with Datepicker. It works great when the user has to select date from current month or from month of the same year. I showed a form with datepicker to few people and ask them to select a date from past years for example Oct 15, 1995. I found them struggling with changing the Year. Most of them used the arrows in month view to go back which irritates user if they have to go back few years.

@julianobrasil
Copy link
Contributor

julianobrasil commented Jul 18, 2017

It's already being tracked: #4853.

Edit: Oh, sorry, it's a different request. Material Design Specs says something nice for mobile (image bellow) but doesn't say much for desktops (but the recommendation to use segmented dropdown buttons, which matches @mschering's request).

image

image

@andrewseguin andrewseguin added the feature This issue represents a new feature or feature request rather than a bug or bug fix label Jul 18, 2017
@jonsamwell
Copy link

+1

1 similar comment
@elmoyeldo
Copy link

+1

@naveedahmed1
Copy link

@mmalerba is there any update on this? should we expect it to be included in next release?

@mmalerba
Copy link
Contributor

I'm probably not going to have time to work on this for the next month or two, I have a lot of other things currently on my plate.

@mahmood-sajjadi
Copy link

without this feature, date picker is not usable because for the birthday, if user age is 35, he/she should press prev year button 35 times 😨

@erikhaug
Copy link

erikhaug commented Sep 1, 2017

+1

@wiekonek
Copy link

wiekonek commented Sep 6, 2017

We really need this! Current datepicker isn't usable in most cases. Please consider this feature as important.

@agnislav
Copy link

The same concern for a birthday. Our users 18 to 60+ yrs old.

@BenRacicot
Copy link

BenRacicot commented Sep 12, 2017

Hey @agnislav I have the same issue and until we get the year select implemented I at least was able to work with the min/max dates to minimize the year clicking based on if:

  1. 18 years ago from today is the youngest a user can be
  2. user must be under 100 years old
startAt: Date;
minDate = new Date(Date.now());
maxDate = new Date(Date.now());
startDate: Date;
datepickerDisabled: boolean;
date: Date;


ngOnInit() {
    // setting the min date and thus the max birth date allowing < 100 year old choosable birthdate
    this.minDate.setDate( this.minDate.getDate() );
    this.minDate.setFullYear( this.minDate.getFullYear() - 100 );
        
    // setting the calendar's start date and youngest birth dates for > 18 years old
    this.maxDate.setDate( this.maxDate.getDate() );
    this.maxDate.setFullYear( this.maxDate.getFullYear() - 18 );
    this.startDate = this.maxDate;
}

<md-input-container>
    <input mdInput [mdDatepicker]="birthDatePicker" formControlName="birthDate" placeholder="birthdate" [min]="minDate" [max]="maxDate">
    <md-datepicker-toggle mdSuffix [for]="birthDatePicker"></md-datepicker-toggle>
    <md-datepicker #birthDatePicker startView="year" [startAt]="startDate"></md-datepicker>
    <md-error *ngIf="form.controls['birthDate'].hasError('mdDatepickerMin') && form.controls['birthDate'].touched">You can't be over 100 years old</md-error>                
    <md-error *ngIf="form.controls['birthDate'].hasError('mdDatepickerMax') && form.controls['birthDate'].touched">Users must be at least 18 years old</md-error>                
</md-input-container>

Maybe someone can help optimize this? And at least the user will begin at the 18th year and cannot click back to a date that would make them over 100 years old.

@vaibhavrtk
Copy link

vaibhavrtk commented Sep 13, 2017

+1 for this feature
Almost unusable for Date of births

@robert-skinner
Copy link

It's a shame, I like it but I won't be using it until this gets implemented!

@ghost
Copy link

ghost commented Oct 2, 2017

+1 for this
Same issue with date of births

@padilla-jm
Copy link

+1
same issue for date of birth, have to use something else

@donroyco donroyco mentioned this issue Oct 10, 2017
@drait
Copy link

drait commented Oct 13, 2017

+1
Same issue for that date of birth!.any update from angular team?!

@ankitraonka
Copy link

ankitraonka commented Oct 16, 2017

This is one of the most common issue. Is there any date to fix this?

@Lakston
Copy link

Lakston commented Oct 26, 2017

Came into this problem today too to implement a birth date picker. I'll give it a look but it will probably be way over my skill level to implement it :)

@ankitraonka
Copy link

@mmalerba any updates?

@mmalerba
Copy link
Contributor

up-ing the priority, I know it's painful without this, I'll try to work on it as soon as I have the time

@mmalerba mmalerba added the P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful label Oct 31, 2017
@naveedahmed1
Copy link

Awesome! It would be great to have time picker as well.

@RichardBoyder
Copy link

mmalerba , Any news for us yet with regards to this?

@Lakston
Copy link

Lakston commented Nov 7, 2017

They just released v5.0.0 RC and there was no mention of this in it. I removed the picker from my app personally and use something else as it was not usable in the current state.

I understand that there is a lot to do though so thanks for taking care of this none the less :)

@RichardBoyder
Copy link

agreed. The work these guys have done is awesome. We will be patient then.

@ankitraonka
Copy link

@mschering how are you using datepicker for birthdate? the ouput is in utc so the date will differ based on your server location.

@vividpixel
Copy link

+1

2 similar comments
@harudragneel
Copy link

+1

@gogakoreli
Copy link

+1

@vitaly-t
Copy link

This is by far the longest-living and the most ignored P1 bug. How did Material even get released without this fixed...? And now it just seems abandoned. What's going on, guys?

@julianobrasil
Copy link
Contributor

julianobrasil commented Dec 23, 2017

@vitaly-t, it's not abandoned. This feature has already been implemented and will probably be available in the next minor release: #8565

@ahmadsolehin
Copy link

how to solve this issue?

@julianobrasil
Copy link
Contributor

Upgrade material to the latest version.

@Benno007
Copy link

Is it possible to go from e.g. month mode, and the period saying 'May 2018' to 'year mode' and the period saying '2018', then clicking '2018' takes you to multi year mode?

@julianobrasil
Copy link
Contributor

julianobrasil commented May 17, 2018

@Benno007, I'm afraid there isn't such feature. Maybe an @Output() that emits when the user clicks on the period button is enough (as you can just close and reopen the calendar in the desired mode). You can open a new issue requesting for this feature.

@angular angular deleted a comment from torabian Dec 1, 2018
@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 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful
Projects
None yet
Development

Successfully merging a pull request may close this issue.