Skip to content
This repository was archived by the owner on Aug 30, 2018. It is now read-only.
This repository was archived by the owner on Aug 30, 2018. It is now read-only.

Shopify.formatMoney in timber.js has incorrect default thousands separator #602

@canardos

Description

@canardos

Function Shopify.formatMoney from timber.js has a default thousands separator of ',' and therefore all cases in the below code from the same function produce a ',' thousands separator whereas the first two should not:

switch(formatString.match(placeholderRegex)[1]) {
  case 'amount':
    value = formatWithDelimiters(cents, 2);
    break;
  case 'amount_no_decimals':
    value = formatWithDelimiters(cents, 0);
    break;
  case 'amount_with_comma_separator':
    value = formatWithDelimiters(cents, 2, '.', ',');
    break;
  case 'amount_no_decimals_with_comma_separator':
    value = formatWithDelimiters(cents, 0, '.', ',');
    break;
}

I believe this:

thousands = defaultOption(thousands, ',');

Should be:

thousands = defaultOption(thousands, '');

The decimal and comma separator parameters are also in the wrong order in the calls in the case statements (or the formatWithDelimiters parameter list).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions