Skip to content

Instantly share code, notes, and snippets.

@LuisSevillano
Created December 21, 2017 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LuisSevillano/a6cd2b149155d828fb50ae6039a486cd to your computer and use it in GitHub Desktop.
Save LuisSevillano/a6cd2b149155d828fb50ae6039a486cd to your computer and use it in GitHub Desktop.
Formating numbers and dates in Spanish
import { timeFormatLocale } from 'd3-time-format';
import { formatLocale } from 'd3-format';
// You need 'rollup-plugin-json' in rollup.config.js
import es from 'd3-format/locale/es-ES.json';
import ES from 'd3-time-format/locale/es-ES.json';
export default function() {
var locale = timeFormatLocale(ES);
var formatted = formatLocale(es).format;
var f = formatted('2,');
var months = function(date) {
var str = locale.format('%B')(date);
return str[0].toUpperCase() + str.substring(1, str.length);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment