Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeFormat: add support for more than two dayPeriod : CLDR's "B" and "b" #343

Closed
jungshik opened this issue May 1, 2019 · 6 comments
Assignees
Labels
c: datetime Component: dates, times, timezones s: in progress Status: the issue has an active proposal

Comments

@jungshik
Copy link

jungshik commented May 1, 2019

In some locales, they have more than two day periods (AM/PM).

CLDR has data for flexible day periods (B) and 'am, pm, noon, midnight' (b) in addition to "AM/PM" (a). https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-period .

For instance, Chinese (zh) locale data has the following, but there is no way to format time with 'B' or 'b'.

{{{
dayPeriod{
format{
abbreviated{
afternoon1{"中午"}
afternoon2{"下午"}
evening1{"晚上"}
midnight{"午夜"}
morning1{"早上"}
morning2{"上午"}
night1{"凌晨"}
}

....

        availableFormats{
            Bh{"Bh时"}
            Bhm{"Bh:mm"}
            Bhms{"Bh:mm:ss"}
            E{"ccc"}
            EBhm{"EB h:mm"}
            EBhms{"EB h:mm:ss"}

}}}

@jungshik
Copy link
Author

jungshik commented May 1, 2019

@jungshik
Copy link
Author

jungshik commented May 1, 2019

@sffc

@FrankYFTang
Copy link
Contributor

I think there are several other time formatting could be improved. Maybe we should put all of that into a proposal instead of dealing with that one by one.

Beside B and b for dayPeriod the other two set are Q/q for quarter and W/w for week

The current skeleton to pattern mapping in locales/zh.txt related to B/b Q/q and W/w

            availableFormats{
                Bh{"Bh时"}
                Bhm{"Bh:mm"}
                Bhms{"Bh:mm:ss"}
                ...
                EBhm{"EBh:mm"}
                EBhms{"EBh:mm:ss"}
                ...
                yQQQ{"y年第Q季度"}
                yQQQQ{"y年第Q季度"}
                yw{
                    other{"Y年第w周"}
                }
            }                                       

in locales/en.txt

            availableFormats{
                Bh{"h B"}
                Bhm{"h:mm B"}
                Bhms{"h:mm:ss B"}
...
                EBhm{"E h:mm B"}
                EBhms{"E h:mm:ss B"}
  ...
                MMMMW{
                    one{"'week' W 'of' MMMM"}
                    other{"'week' W 'of' MMMM"}
                }
...
                yQQQ{"QQQ y"}
                yQQQQ{"QQQQ y"}
                yw{
                    one{"'week' w 'of' Y"}
                    other{"'week' w 'of' Y"}
                }

@FrankYFTang
Copy link
Contributor

I will start a proposal under ECMA402 to extend the DateTimeFormat options

@sffc sffc added c: datetime Component: dates, times, timezones s: comment Status: more info is needed to move forward labels May 1, 2019
@sffc
Copy link
Contributor

sffc commented Jun 5, 2020

@FrankYFTang Is this issue covered by #346 ?

@FrankYFTang
Copy link
Contributor

@FrankYFTang Is this issue covered by #346 ?

yes

@sffc sffc added s: in progress Status: the issue has an active proposal and removed s: comment Status: more info is needed to move forward labels Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: datetime Component: dates, times, timezones s: in progress Status: the issue has an active proposal
Projects
None yet
Development

No branches or pull requests

3 participants