Promact / md2

Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Collapse, Colorpicker, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.
http://code.promactinfo.com/md2/
MIT License
379 stars 112 forks source link

DatePicker parses with Y, but doesn't format with Y. #317

Open commandertaggart opened 6 years ago

commandertaggart commented 6 years ago

Bug, feature request, or proposal:

This is a bug.

What is the expected behavior?

A 'format' property that includes years with a capital Y will parse 2-digit years as 20XX (where lowercase y parses 2-digit years as 19XX). When entering a year with 2 digits, and a format of MM-dd-YYYY, the resulting value should be accurate. (e.g. entering "5/23/18" should result in a final value of "05-23-2018".)

What is the current behavior?

The _formatDate() method of the date picker does not recognize capital Y in the format, so a format of "MM-dd-YYYY" and an entered value of "5/23/18" displays as "05-23-YYYY"

What are the steps to reproduce?

Create a component with a format of "MM-dd-YYYY". Enter any parseable date value.
Note incorrect display.

Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: http://plnkr.co/edit/rQmUz8WYRh5Vz4gwY8E4?p=info

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

There is currently no way to support 2-digit year entry and have the resulting year be current.

Which versions of Angular, MD2, OS, browsers are affected?

We are using Angular 4.1.2, MD2 0.0.19, Mac OS and Chrome, but a review of the current MD2 code indicates that this issue persists.

Is there anything else we should know?

I would be happy with lowercase y parsing a two-digit year as 20XX as well.