Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Date parser not working if format string contains literal words #5091

Closed
jpmitche11 opened this issue Dec 17, 2015 · 5 comments
Closed

Date parser not working if format string contains literal words #5091

jpmitche11 opened this issue Dec 17, 2015 · 5 comments

Comments

@jpmitche11
Copy link
Contributor

I believe a recent commit broke the parsing of dates that contain quoted literals:
9513f10

Tested with the 'mediumDate' format using the portuguese locale pt-br (d 'de' MMM 'de' y HH:mm:ss)

The angular date formats use single quotes, not backticks. If you claim to support the locale base date formats, then this should be fixed.

Attn: @wesleycho

@wesleycho
Copy link
Contributor

I changed it to backticks because single quotes are really awkward due to having to do a lot of escaping.

@wesleycho
Copy link
Contributor

@Foxandxss what do you think? I could revert the breaking change, but this will be cumbersome for normal consumption & lead to hard to read strings in the HTML.

Very much dislike this request.

@jpmitche11
Copy link
Contributor Author

I think this is a mistake. Angular has supplied the date format syntax, this library is merely an implementation of that.
If you want to use your own format, then it would be an error to look up the date format strings from $locale. Those are angular formats, not ui-bootstrap formats.

@jpmitche11
Copy link
Contributor Author

Here is a plunkr that illustrates my problem.
All I am doing is attempting to use the date parser with 'mediumDate' as the format, while using the pt-br locale.
http://plnkr.co/edit/ulvQQMc3OkET2VDfxktc

@wesleycho
Copy link
Contributor

IMO I think Angular/Google got this wrong, but getting them to change it is probably not going to happen from an engineering standpoint (it would break prior contract, creating compatibility problems maintaining two different formats), so this appears that it might force us into a subpar API.

I understand your request, and we may end up reverting the change I made, I just want a second opinion since I really do not like the awkwardness of using a single quote.

@wesleycho wesleycho added this to the 1.0.0 milestone Jan 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants