Repository navigation
Conversation
seanlynch7194
left a comment
There was a problem hiding this comment.
I ran the updated code through the scenario that previously triggered the bug and can confirm the patch resolves it. No unexpected behaviour observed.
|
Thanks for this — the problem is real, and #15 fixes it a different way. Your reading of it is right: a date parsed here, serialised with
So #15 leaves parseBarcode("]C117250630").parsedCodeItems[0].isoDate // "2025-06-30", in any timezoneThat is the value to send to a server. Nothing existing changes, and there is no timezone in which someone is worse off. Closing this one, but the report is what got it fixed — thank you. |
At the moment the method
parseBarcodeinstantiates 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:
15240300A 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.