Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIn custom date/time format add support for using local date and time sepraters #36752
Comments
|
Thanks for the issue. If this info isn't available then we would not be able to support it. Generally we are not adding custom format codes to our date/time formatting features. |
|
I checked in CLDR data, it looks like time separate is available there (and it looks like angular reads it too, I checked gulp script that extracts localization data). However, the date separator is not available. But, a lot of other frameworks (like .net) make the value of date separator avail (I think they also use CLDR data, however not sure, maybe they parsed date format from CLDR to make that value available). https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-sep |
|
When I looked at the .NET framework, I saw a function that you could use to provide your own separator, but I did not see that it was set automatically from the locale. Given that the date separator is not available, I don't think this is something we will implement. |
|
You could work around this, if you had the data, by pre-processing the format string using a custom pipe that sits on top of the |
|
yes, that would work. But, while I was going through CLDR data I found there are few other formats available in |
|
If |
|
https://www.unicode.org/reports/tr35/tr35-55/tr35-dates.html#availableFormats_appendItems describes what was the purpose of |
|
I tried reading that section of spec that you linked. It is pretty dense stuff, and I struggled to understand how it would be implemented to solve your problem. Could you put together an explanation of what would be involved to support this? |
Relevant Package
This feature request is for @angular/commonDescription
According to location date separators varies betweensimilarly time separator also changes according to location.
Currently, Angular does not provide any way to use localized date and time separators in custom formats. Due to this if a user wants to customize date/time format then he/she can't have location-specific separators.
Describe the solution you'd like
Angular can reserve some format pattern for specifying date separator and time separator. LikeD-> date separatorT-> time separatorDescribe alternatives you've considered
I don't; think above pattern are good enough as `d` & `D` can be confusing and someone may be using `T` in his/her custom format (as T is part of ISO format).I also thought about
ds-> date separatorts-> time separatorbut, Angular is already using
sso it can lead to confusion. Maybe we can discuss a right pattern here.