Skip to content

Commit 836d5a2

Browse files
committed
templateFormatString: use d3locale.timeFormat if available fot date fmt
1 parent c6370d9 commit 836d5a2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Diff for: src/lib/index.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1068,16 +1068,12 @@ function templateFormatString(string, labels, d3locale) {
10681068
if(format) {
10691069
var fmt;
10701070
if(format[0] === ':') {
1071-
if(d3locale) {
1072-
fmt = d3locale.numberFormat;
1073-
} else {
1074-
fmt = d3.format;
1075-
}
1071+
fmt = d3locale ? d3locale.numberFormat : d3.format;
10761072
value = fmt(format.replace(TEMPLATE_STRING_FORMAT_SEPARATOR, ''))(value);
10771073
}
10781074

10791075
if(format[0] === '|') {
1080-
fmt = d3.time.format.utc;
1076+
fmt = d3locale ? d3locale.timeFormat.utc : d3.time.format.utc;
10811077
var ms = lib.dateTime2ms(value);
10821078
value = lib.formatDate(ms, format.replace(TEMPLATE_STRING_FORMAT_SEPARATOR, ''), false, fmt);
10831079
}

0 commit comments

Comments
 (0)