Skip to content

getLabelForValue returns the wrong format in time scale #12128

@hokolomopo

Description

@hokolomopo

Expected behavior

Calling timeScale.getLabelForValue(value) should return a value formatted with the format in options.displayFormats for the current time unit.

Current behavior

Calling timeScale.getLabelForValue(value) returns a value in the datetime format, instead of the format defined in options.displayFormats for the current time unit.

Reproducible sample

https://codepen.io/Adrien-Minne/pen/jEWrqRK

Optional extra steps/info to reproduce

No response

Possible solution

Probably a simple change in time scale is needed

Context

No response

chart.js version

v4.5.0

Browser name and version

Google chrome Version 140.0.7339.185

Link to your project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions