Closed Bug 1273362 Opened 8 years ago Closed 5 years ago

toLocaleString adds extra punctuation to generated String

Categories

(Core :: JavaScript: Internationalization API, defect)

46 Branch
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jmassey, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0
Build ID: 20160502172042

Steps to reproduce:

The following JavaScript code will always produce incorrect output.

var dateOptions = {
    weekday: "short",
    year: "numeric",
    month: "short",
    day: "numeric",
    hour: "2-digit",
    minute: "2-digit"
};
var date = "2016-03-14T02:49:54.000Z";
var dateString = new Date(date).toLocaleString("en-AU", dateOptions);




Actual results:

dateString generated as 'Mon., 14 Mar.,2016, 10:49 am'

Note the ., characters after the day and month.


Expected results:

dateString generated as 'Mon, 14 Mar,2016, 10:49 am'
Component: Untriaged → JavaScript: Internationalization API
Not to propose that one format or the other is better, but.

The Intl API does not guarantee particular formatting in response to particular options.  There is no spec-level guarantee that "short" weekdays will be abbreviations or that those abbreviations will or will not use periods.  You shouldn't rely on these particular formatting details, nor to some extent should you be requesting us to select/adopt particular formatting.

This particular formatting decision is really more a function of the particular language/locale and its conventions.  If you strongly think lack of periods is desirable, you probably should request the change from the CLDR people.  http://cldr.unicode.org/  We'll adopt (in time) whatever they choose to specify.  And I strongly doubt we'll deviate from whatever they've selected for this stuff.
Can we close this then?

No longer reproducible with current CLDR. The test case from comment #0 now displays "Mon, 14 Mar 2016, 10:49 am" (with TZ=Australia/Perth). Therefore resolving as WFM.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.