Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

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

Open
commandertaggart opened this issue Apr 23, 2018 · 0 comments
Open

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

commandertaggart opened this issue Apr 23, 2018 · 0 comments

Comments

@commandertaggart
Copy link

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.

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

1 participant