Bug 133637 - new Date().getFullYear().toLocaleString('ar or kr') The results are displayed in a comma.
Summary: new Date().getFullYear().toLocaleString('ar or kr') The results are displayed...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-09 00:17 PDT by ezBuilder
Modified: 2018-07-27 10:33 PDT (History)
1 user (show)

See Also:


Attachments
The results by your browser. (44.21 KB, image/png)
2014-06-09 00:19 PDT, ezBuilder
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ezBuilder 2014-06-09 00:17:24 PDT
new Date (). getFullYear (). toLocaleString ('ar') 
new Date (). getFullYear (). toLocaleString ('ko') 
new Date (). getFullUTCYear (). toLocaleString ('ar') 
new Date (). getFullUTCYear (). toLocaleString ('ko') 

Currently, the latest version of CHROME, IE, FF, SAFARI the results of running the above code is stamped out a comma. 

I wonder why the comma is visible too.
Comment 1 ezBuilder 2014-06-09 00:19:07 PDT
Created attachment 232696 [details]
The results by your browser.
Comment 2 Andy VanWagoner 2018-07-27 10:33:07 PDT
Since this ticket was created ECMA 402 Internationalization API has been adopted by all these browsers.

Depending on your locale, the grouping separator will be included in localized numbers. You can always request it not be included, though

new Date().getFullYear().toLocaleString('ar', { useGrouping: false })
"٢٠١٨"

Most locales won't use grouping separators when they know they are formatting a year. There may also be additional characters used to show it is a year. For this specific use case, you'd probably be better off doing:

new Date().toLocaleString('ko', { year: 'numeric' })
"2018년"

instead of

new Date().getFullYear().toLocaleString('ko', { useGrouping: false })
"2018"