Created
December 21, 2017 14:33
-
-
Save LuisSevillano/a6cd2b149155d828fb50ae6039a486cd to your computer and use it in GitHub Desktop.
Formating numbers and dates in Spanish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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