August 2018
Intermediate to advanced
366 pages
10h 14m
English
The basic idea of parse_iso8601 is that whatever dialect of ISO 8601 is received before parsing it, we will transform it into the form of [YYYY][MM][DD]T[hh][mm][ss]+-[TZ].
The hardest part is detecting the time zone, as that can be separated by +, -, or can even be Z. Once the time zone is extracted, we can just get rid of all examples of - in the date and all instances of : in times.
Note that before extracting the time zone we separated the time from the date, as both the date and the time zone might contain the - character, and we don't want our parser to get confused.