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

Datepicker uses wrong month names from localization file #5440

Open
Janneman84 opened this issue Feb 8, 2016 · 9 comments
Open

Datepicker uses wrong month names from localization file #5440

Janneman84 opened this issue Feb 8, 2016 · 9 comments

Comments

@Janneman84
Copy link

I'm localizing an application to Polish, and it turns out that languages from that region have two different versions of each month's name.

More info here:
angular/angular.js#10247

Now the datepicker seems to be using the wrong ones. In Angular's localization files both versions are present. Basically the datepicker should use STANDALONEMONTH for in the popup (lists, dropdowns etc.). The other version should be used when formatting date strings, above link provides a regex to determine when to use what.

So is it possible to make the datepicker use the right month names (or maybe I'm just overlooking something)?

@Foxandxss
Copy link
Contributor

We are relying on the date filter to do that kind of stuff.

@icfantv
Copy link
Contributor

icfantv commented Feb 8, 2016

@Foxandxss, so is there anything for us to do here?

@Foxandxss
Copy link
Contributor

Not sure but I don't think so.

@Janneman84
Copy link
Author

The date filter is for formatting date strings right? For the text field I understand that's the date filter's responsibility and that probably already works correctly.

However this is about the picker popup. In there it can show a list of months and those names should be different. You can get those from $locale.DATETIME_FORMATS.STANDALONEMONTH, every locale file has it. You only need to change the key from MONTH to STANDALONEMONTH really, or am I thinking too simple?

@wesleycho
Copy link
Contributor

This would need to be changed in the dateparser - this sounds like a legitimate change.

Feel free to open a PR with the fix.

@Janneman84
Copy link
Author

I took a look at the source code of the datepicker. I agree now that the date filter may be the real place to be to address this issue. I'll look into it some more when I have the change.

@Janneman84
Copy link
Author

I've been told that the date filter in Angular 1.5.1 will support the alternative month names by using 'LLLL'. This means that in the datepicker the constant formatMonth should be changed to 'LLLL' and formatMonthTitle to 'LLLL yyyy'.

I don't know if it's hard to build in some kind of fallback in case LLLL isn't available, probably not.

@wesleycho
Copy link
Contributor

When it lands in the date filter, a modification will be needed to added to support the LLLL format in the dateparser as well. I'm ok with this since I can't conceive of a situation where a user would want that string arbitrarily in the date format string.

@vadim-zverugo
Copy link

vadim-zverugo commented Sep 6, 2016

@wesleycho: Same issue. Looks like LLLL doesn't work for the formatMonth datepicker option.
Need to add the following code to the uibDateParser:

...
{
  key: 'LLLL',
  regex: $locale.DATETIME_FORMATS.STANDALONEMONTH.join('|'),
  apply: function(value) { this.month = $locale.DATETIME_FORMATS.STANDALONEMONTH.indexOf(value); },
  formatter: function(date) { return dateFilter(date, 'LLLL'); }
},
...

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

5 participants