Skip to content

Commit 3cbbae3

Browse files
committed
Fix issue 6751: epoch date formats '%H:%M:%S' as 'undefined'
This patch fixes issue #6751, where the epoch timestamp '1970-01-01 00:00:00', with 'hoverformat' '%H:%M:%S' is formatted as 'undefined'. Signed-off-by: adamjhawley <[email protected]>
1 parent 630b092 commit 3cbbae3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/plots/cartesian/axes.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,9 @@ function formatDate(ax, out, hover, extraPrecision) {
17441744
var tr = ax._tickround;
17451745
var fmt = (hover && ax.hoverformat) || axes.getTickFormat(ax);
17461746

1747+
// Only apply extra precision if no explicit format was provided.
1748+
extraPrecision = !fmt && extraPrecision;
1749+
17471750
if(extraPrecision) {
17481751
// second or sub-second precision: extra always shows max digits.
17491752
// for other fields, extra precision just adds one field.
@@ -1768,7 +1771,7 @@ function formatDate(ax, out, hover, extraPrecision) {
17681771
// anything to be uniform with!)
17691772

17701773
// can we remove the whole time part?
1771-
if(dateStr === '00:00:00' || dateStr === '00:00') {
1774+
if(headStr !== undefined && (dateStr === '00:00:00' || dateStr === '00:00')) {
17721775
dateStr = headStr;
17731776
headStr = '';
17741777
} else if(dateStr.length === 8) {

0 commit comments

Comments
 (0)