components icon indicating copy to clipboard operation
components copied to clipboard

Date-picker is not setting the value when entered via keyboard

Open MaickelHubner opened this issue 9 years ago • 6 comments

Bug, feature request, or proposal:

When I type (via keyboard) a value in the format DD/MM/YYYY, the component is not setting the entered date

What is the expected behavior?

When entering a date via keyboard, it is set in the component

What is the current behavior?

When entering via keyboard the date is null

What are the steps to reproduce?

1 2 3

Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: https://goo.gl/DlHd6U

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

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

Angular 4.2.3 Material 2.0.0-beta.7, MacOSX 10.12.5, Typescript 2.2.2 and Safari 10.1.1

Is there anything else we should know?

My code (no secrets) - Local format and time: Brazil UTC-3:

<md-input-container *ngIf="atualiza_data_fim"> <input mdInput placeholder="Até" [mdDatepicker]="dataAte" [(ngModel)]="data_fim"> <button mdSuffix [mdDatepickerToggle]="dataAte"> <md-datepicker #dataAte [startAt]="data_fim" [touchUi]="true">

MaickelHubner avatar Jun 21 '17 19:06 MaickelHubner

Is it working with a MM/DD/YYYY value?

willshowell avatar Jun 21 '17 19:06 willshowell

Yes, @willshowell. If I inform in MM/DD/YYYY format it works.

MaickelHubner avatar Jun 22 '17 12:06 MaickelHubner

Look at some of these other issues for working with a dateadapter. The datepicker can't automatically know which format you wish to use, so you must instruct it via some configuration.

@julianobrasil's plunker here shows it working with brazilian portuguese locale https://plnkr.co/edit/FlgGpjqyDlypas0VZJzo?p=preview

willshowell avatar Jun 22 '17 13:06 willshowell

Thanks @willshowell. It worked!!!

MaickelHubner avatar Jun 22 '17 14:06 MaickelHubner

Thanks @willshowell this solution saved me!

DevGomes avatar Sep 06 '17 18:09 DevGomes

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.