Skip to content

Track with time that include timezone cannot be parsed #5

@Applitom

Description

@Applitom

Hello, It is me again :) Thank you so much for this lovely open source!

I have an issue with parsing my GPX files that includes time zone in the track time.
Example :

<trkpt lat="45.295147" lon="6.590345"> <ele>2395.221668</ele> <time>2018-02-02T10:47:30+01:00</time> <hdop>3</hdop> <vdop>0</vdop> <extensions> <gte:gps speed="9.740301" azimuth="-1.000000" /> </extensions> </trkpt>

When I try to parse this file, I get nil in the track points.
After investigation I figured that the problem is with the dateFormat string in the DateFormatter+Extensions file.
When I change it to be "yyyy-MM-dd'T'HH:mm:ssZ" instead of "yyyy-MM-dd'T'HH:mm:ss'Z'" it works perfectly.

Reference for this fix:
https://stackoverflow.com/questions/41907419/ios-swift-3-convert-yyyy-mm-ddthhmmssz-format-string-to-date-object

I fixed it in my forked repo and i wonder if this is a valid fix, you can see it here:
master...Applitom:master

Please let me know if you think i can submit PR for this fix or if you think of other solution.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions