Skip to content

Comments

date fields of GS1 barcodes should consider the timezone offset#2

Open
yoolandes wants to merge 1 commit intoMaximBelov:masterfrom
yoolandes:bugfixes/fix_values_of_date_fields
Open

date fields of GS1 barcodes should consider the timezone offset#2
yoolandes wants to merge 1 commit intoMaximBelov:masterfrom
yoolandes:bugfixes/fix_values_of_date_fields

Conversation

@yoolandes
Copy link

At the moment the method parseBarcode instantiates a date with the users current timezone. This could be problematic when storing the values of the date fields in a database.

For example the library parses the following GS1 barcode: 15240300
A user who lives in a timezone with a negative offset of minus 1 hour would send the following ISO date to the server: `2024-03-30T23:00:00.000Z
The server interprets the date as an UTC date and would store the wrong value "2024-03-30" in the database.

Reading the date fields as UTC dates would fix this problem.

Copy link

@seanlynch7194 seanlynch7194 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the updated code through the scenario that previously triggered the bug and can confirm the patch resolves it. No unexpected behaviour observed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants