I'm using vue-i18n to format dates, like so:
const setDateTimeFormats = {
short: {
year: 'numeric',
month: 'long',
day: 'numeric',
},
};
export const dateTimeFormats = {
en: setDateTimeFormats,
ja: setDateTimeFormats,
};
And then calling it like this:
checkedOn() {
return this.$d(moment(checkedOn), 'short');
},
But what I can't figure out is how to localize and format the ticks using D3 in the same project.
Here's the bit concerned with the ticks (which just shows the months from Jan to now: Jan Feb Mar Apr May Jun Jul Aug Sep)
const x = scaleTime()
.domain([moment('2020-01-01').toDate(), moment().toDate()])
.range([0, width]);
svg.append('g')
.attr('class', 'xaxis')
.attr('transform', `translate(0, ${height})`)
.call(axisBottom(x).tickFormat(timeFormat('%b')));