Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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]>
  • Loading branch information
adamjhawley committed Oct 18, 2023
commit 3cbbae3f28dec7d482b352a814992c8cd3551a06
5 changes: 4 additions & 1 deletion src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,9 @@ function formatDate(ax, out, hover, extraPrecision) {
var tr = ax._tickround;
var fmt = (hover && ax.hoverformat) || axes.getTickFormat(ax);

// Only apply extra precision if no explicit format was provided.
extraPrecision = !fmt && extraPrecision;

if(extraPrecision) {
// second or sub-second precision: extra always shows max digits.
// for other fields, extra precision just adds one field.
Expand All @@ -1768,7 +1771,7 @@ function formatDate(ax, out, hover, extraPrecision) {
// anything to be uniform with!)

// can we remove the whole time part?
if(dateStr === '00:00:00' || dateStr === '00:00') {
if(headStr !== undefined && (dateStr === '00:00:00' || dateStr === '00:00')) {
dateStr = headStr;
headStr = '';
} else if(dateStr.length === 8) {
Expand Down