Skip to content

February 29th on unspecified year #20

@SylvainBigonneau

Description

@SylvainBigonneau

Using v2.7.1, here is another tricky corner case:

> edtf('21XX-02-29').edtf // expecting '21XX-02-29'
'21XX-03-01'

Since some unspecified year components can match leap years, the library should not move that date to March.

But then we should be careful! Because some other unspecified years such as "21X3" never match a leap year and should therefore behave accordingly.

But right now, the behavior is basically depending on whether the "chosen builtin date" is a leap year, which gives inconsistent results:

> edtf('24XX-02-29').edtf // expecting '24XX-02-29'... good
'24XX-02-29'
> edtf('21XX-02-29').edtf // expecting '21XX-02-29'... wrong
'21XX-03-01'

Would it be possible to check whether there is a matching leap year among the ones matching the year component, and set the Date element to the first occuring leap year?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions