VBA-tools / VBA-UTC

UTC and ISO 8601 date conversion and parsing for VBA
MIT License
57 stars 28 forks source link

ParseIso fails if region settings have date order of DD/MM/YYYY #9

Open paulhickman-ec opened 7 months ago

paulhickman-ec commented 7 months ago

Sorry: had to edit this a lot as I had the wrong cause orginally.

The ParseIso method gets the wrong date if there is no : between the hours and minutes in the timezone

e.g. ParseIso("2024-03-11T17:40:00.000+0800") gives 07/02/2024 09:00:40

ParseIso("2024-03-11T17:40:00.000+08:00") gives the correct value 11/03/2024 09:40:00

Nick-vanGemeren commented 7 months ago

The ParseIso method gets the wrong date if there is no : between the hours and minutes in the timezone e.g. ParseIso("2024-03-11T17:40:00.000+0800") gives 07/02/2024 09:00:40 09:40:00

So, a completely different issue.

As you may have realised, the date time was shifted back 800 hours (33d 8h) to your local time zone (UTC+0).

ParseIsohas several problems parsing ISO 8601 date times, the main one being that it only supports strings with separators in the date, time and zone parts (extended format). [I'm not clear on whether ISO 8601 allows mixing of extended and basic format in one string.]

I do haveParseIsocode which will support basic format (and more) and fixes some bugs., but it is not currently in a state for release. If the issue is serious for you, I can dust it off.