Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Armenian (locale "hy") is not working #323

Closed
bagratzakaryan opened this issue Dec 17, 2018 · 2 comments
Closed

Armenian (locale "hy") is not working #323

bagratzakaryan opened this issue Dec 17, 2018 · 2 comments

Comments

@bagratzakaryan
Copy link

Hello,
I would like to make Date in Armenian (locale "hy") but in my case when I include the CDN Javascript into HTML it is not working, and show "2018 M12 17, Mon".

<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.hy"></script>
<script>
    var x = new Intl.DateTimeFormat(
        'hy', {
            weekday: 'long',
            year: 'numeric',
            month: 'long',
            day: 'numeric'
        }).format(new Date);

    console.log(x);
</script>

How can I solve this issue ?

@okuryu
Copy link
Contributor

okuryu commented Dec 18, 2018

The polyfill service applies the pollyfill to only an user agent which doesn't have the Intl feature implementation. This means the polyfill service doesn't apply the polyfill if you're using Chrome since Chrome supports the Intl features.

So, I've verified your result 2018 M12 17, Mon on Chrome. It's a behavior of Chrome not Intl pollyfill. I also found an issue related to hy locale for Chromium ( #842524 ). It might be related to your problem.

As a workaround for your problem, please try following step. You may be able to resolve your issue.

  1. install the Intl pollyfill via npm
$ npm install intl
  1. create a test.html file like this
<script src="./node_modules/intl/dist/Intl.js"></script>
<script src="./node_modules/intl/locale-data/jsonp/hy.js"></script>
<script>
var x = new IntlPolyfill.DateTimeFormat('hy', {
  weekday: 'long',
  year: 'numeric',
  month: 'long',
  day: 'numeric'
}).format(new Date);

console.log(x);
</script>
  1. open the test.html and try to check the console on your browser

@bagratzakaryan
Copy link
Author

Thank you very much!

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

2 participants