Skip to content

[BUG] Can not display the right datetime #576

@zlf7735268

Description

@zlf7735268

Expected Behavior

When I run the program, the dates on the candlestick chart are not displayed correctly—they appear as garbled characters. I’ve tried modifying the date format in various ways multiple times, but all attempts have failed. The displayed time starts from 1970.

Current Behaviour

Image

Reproducible Example

from lightweight_charts import Chart
import pandas as pd
def main():
    df = pd.DataFrame({
        'time': ['2025-01-01', '2025-01-02', '2025-01-03'],
        'open': [100, 102, 103],
        'high': [103, 104, 105],
        'low': [99, 101, 102],
        'close': [102, 103, 104]})
    chart = Chart()
    chart.set(df)
    chart.show(block=True)
if __name__ == '__main__':
    main()

Environment

- OS:Windows11
- Library: lightweight charts v2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions