Skip to content

Timestamp '1970/01/01 00:00:00' formats as 'undefined' in hovertext #6751

Closed
@adamjhawley

Description

@adamjhawley

I tried to customise the hovertext format of some timestamp data and found that the timestamp '1970/01/01 00:00:00' formats as 'undefined'.

Note: please hover over the first data point in the example below to see the issue I am describing.

Minimal example to recreate the issue (CodePen here):

var dates = [0,1].map(x => `1970-01-01 00:00:0${x}`);

var data = [
  {
    type: 'scatter',
    x: dates,
    y: [5,2,3,1,4],
    hovertemplate: "%{x}, %{y}"
  }]

var layout = {
  xaxis: {
    tickformat: '%H:%M:%S',
    hoverformat: '%H:%M:%S'
  },
}

Plotly.newPlot('myDiv', data, layout);

I am happy to try and fix this issue myself but could benefit from someone pointing me in the right direction. I presume that the issue is caused by something like "0 seconds since epoch" is wrongly resolved as falsey at some point.

Thanks in advance for any pointers/help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions