Sha256: bf3b54d7da3bc07f598bc1144584f9dbf940b5844b9eb3506d41637e832741dc

Contents?: true

Size: 466 Bytes

Versions: 7

Compression:

Stored size: 466 Bytes

Contents

import { DateTime } from 'luxon';
import numeral from 'numeral';

export const numberToCurrency = amount => {
  const format = '$0,0.00';
  const floatAmount = parseFloat(amount);

  if (floatAmount < 0) {
    return `(${numeral(Math.abs(floatAmount)).format(format)})`;
  }

  return numeral(floatAmount).format(format);
};

export const formatTime = time => {
  if (!time) return 'N/A';

  return DateTime.fromISO(time).toLocaleString(DateTime.DATETIME_SHORT);
};

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.17.0 lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js
disco_app-0.18.0 lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js
disco_app-0.18.2 lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js
disco_app-0.18.3 lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js
disco_app-0.18.6 lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js
disco_app-0.18.4 lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js
disco_app-0.18.1 lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js