Skip to content

Commit 2b26e5a

Browse files
committed
convert numeric dates to ms for bars with base
1 parent e65fede commit 2b26e5a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/plots/cartesian/set_convert.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ module.exports = function setConvert(ax, fullLayout) {
9292
* - defaults to ax.calendar
9393
*/
9494
function dt2ms(v, _, calendar, opts) {
95+
if((opts || {}).msUTC && isNumeric(v)) {
96+
// For now it is only used
97+
// to fix bar length in milliseconds & gl3d ticks
98+
// It could be applied in other places in v2
99+
return +v;
100+
}
101+
95102
// NOTE: Changed this behavior: previously we took any numeric value
96103
// to be a ms, even if it was a string that could be a bare year.
97104
// Now we convert it as a date if at all possible, and only try
@@ -100,13 +107,6 @@ module.exports = function setConvert(ax, fullLayout) {
100107
if(ms === BADNUM) {
101108
if(isNumeric(v)) {
102109
v = +v;
103-
if((opts || {}).msUTC) {
104-
// For now it is only used
105-
// to fix bar length in milliseconds.
106-
// It could be applied in other places in v2
107-
return v;
108-
}
109-
110110
// keep track of tenths of ms, that `new Date` will drop
111111
// same logic as in Lib.ms2DateTime
112112
var msecTenths = Math.floor(Lib.mod(v + 0.05, 1) * 10);

0 commit comments

Comments
 (0)