Skip to content

Lowercase month name not parseable #768

@Odaeus

Description

@Odaeus

Hello,

Steps to reproduce

> Timex.parse("march", "{Mfull}")
{:error, "Expected `full month name` at line 1, column 6."}
> Timex.parse("mar", "{Mshort}")
{:error, "Expected `month abbreviation` at line 1, column 4."}

Description of issue

It's surprising that this fails due to the names being completely lowercased. We first discovered this issue while attempting to parse a date with an uppercase month (like "17-DEC-2024"), realised there is no support for that in the parser, but noticed that lowercase is supported by Timex.month_to_num:

> Timex.month_to_num("MAR")
{:error, :invalid_month_name}
> Timex.month_to_num("mar")
3

But this doesn't work in the parser. I would likely be able to contribute if a PR to update this is acceptable?

Thanks!
Andrew

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