pygpx icon indicating copy to clipboard operation
pygpx copied to clipboard

Date time parsing issue

Open wklogoo opened this issue 9 years ago • 5 comments

Currently, the UTC date time in a GPX file is not parsed with UTC time zone.

A suggestion is to use the python-dateutil and replace the current parsing approach with dateutil.parser.

import dateutil.parser

def datetime_iso(string): """Parse an ISO formatted string. E.g: 2006-01-08T06:45:07Z Modified by W. K. Lo 2016-06-09

Return a datetime object.
"""
dt = dateutil.parser.parse(string)
return dt

Hope this fit with other parts well!

Regards, wklogoo

wklogoo avatar Jun 09 '16 14:06 wklogoo

Sorry, I am new to GitHub. Not familiar with the formatting effect (and the preview button) of the text in the post.

This is a really nice piece of gpx module for python!

== repost for easy viewing ==

Currently, the UTC date time in a GPX file is not parsed with UTC time zone.

A suggestion is to use the python-dateutil and replace the current parsing approach with dateutil.parser.

import dateutil.parser

def datetime_iso(string):
 """Parse an ISO formatted string. E.g:
 2006-01-08T06:45:07Z
 Modified by W. K. Lo 2016-06-09
Return a datetime object.
"""
dt = dateutil.parser.parse(string)
return dt

Hope this fit with other parts well!

Regards, wklogoo

wklogoo avatar Jun 09 '16 14:06 wklogoo

@wklogoo

Thanks for the suggestion.

Can you create a PR? If you need help on how to do that let me know.

Thanks

fxdgear avatar Aug 08 '16 17:08 fxdgear

What is a PR? Please suggest some online materials for reference on the operation process of GitHub. Thx.

On Tue, Aug 9, 2016 at 1:25 AM, Nick Lang [email protected] wrote:

@wklogoo https://github.com/wklogoo

Thanks for the suggestion.

Can you create a PR? If you need help on how to do that let me know.

Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fxdgear/pygpx/issues/5#issuecomment-238308058, or mute the thread https://github.com/notifications/unsubscribe-auth/AS663z9reJQK9_rt1bkm0ZnldYEMEEwoks5qd2ZugaJpZM4IyDIS .

Regards, W. K. Lo

wklogoo avatar Aug 09 '16 01:08 wklogoo

PR = pull request.

You can fork this repo under your namespace. Create the change you want. Commit it to your repo.

Then you can create a PR from you're fork onto my repo.

Then I can review and submit feedback/accept it.

And merge your change set in to this Repo.

fxdgear avatar Aug 09 '16 04:08 fxdgear

@wklogoo https://www.thinkful.com/learn/github-pull-request-tutorial/ might help!

mr337 avatar Aug 16 '16 22:08 mr337