Skip to content

[Bug] Date Format {yy} doesn't work as expected #18534

@zoe-walker

Description

@zoe-walker

Version

5.4.2

Link to Minimal Reproduction

https://codesandbox.io/s/yy-date-error-rqmsup

Steps to Reproduce

Use echarts.date.format with a format string containing {yy} on a date with a single digit year (2000 to 2009)
echarts.time.format( "2003-05-04 10:56:30", "Echarts output: {yy} " );

Current Behavior

Returns a string with no padding

Expected Behavior

According to https://echarts.apache.org/en/option.html#timeline.label.formatter:
{yy} -> 00-99
this implies that the number should be padded to be size 2 e.g. 2000 goes to 00, 2003 goes to 03

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

This is a duplicate of #17063 . The issue was not fixed when it was closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions