Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too strict: Unable to parse '000000' date #247

Open
silentbugs opened this issue Dec 15, 2023 · 2 comments
Open

Too strict: Unable to parse '000000' date #247

silentbugs opened this issue Dec 15, 2023 · 2 comments
Labels
breaking Backwards incompatible change enhancement New feature or request

Comments

@silentbugs
Copy link

Hello!

Some of the GS1 barcodes I am scanning contain some silly dates, such as '000000'. Currently parsing fails completely, as month 0 and day 0 are not a valid month/day respectively.

Is it possible to decide how certain errors are handled, and if they should fallback to defaults or fail completely?

Example of a GS1 barcode that fails: 019906600092731431030078881500000010215359

@jodal
Copy link
Owner

jodal commented Dec 17, 2023

Currently, Biip has no configuration options for making the parsing more lenient. It follows the GS1 specifications quite strictly.

However, being able to control Biip's strictness has surfaced as a request several times now, so I think this is the highest prioritized item for any further development of Biip.

@silentbugs
Copy link
Author

Thanks for the swift reply. I really like libraries that are strict with specs, so thanks for doing this.

I will probably end up using biip because it seems like a great library and since I'll have to find a way to parse such barcodes I'll probably fork it and write a PR for this.

I was thinking of writing a class with most of the things currently defined in biip (such as _parse_date()), so that users import that class and configuring it, should they need to. Importing parse directly will give you the parse method with the defaults, as it currently works.

Any thoughts?

@jodal jodal added enhancement New feature or request breaking Backwards incompatible change labels Jul 29, 2024
@jodal jodal changed the title Unable to parse '000000' date Too strict: Unable to parse '000000' date Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Backwards incompatible change enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants