Skip to content

Commit

Permalink
element, overpass: return timestamps as objects
Browse files Browse the repository at this point in the history
  • Loading branch information
franz-benjamin committed Aug 15, 2021
1 parent f2c8b90 commit 487381a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion OSMPythonTools/element.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import copy
import dateutil.parser
import geojson
import re

Expand Down Expand Up @@ -71,7 +72,7 @@ def version(self):
def changeset(self):
return self.__getElement('changeset')
def timestamp(self):
return self.__getElement('timestamp')
return dateutil.parser.isoparse(self.__getElement('timestamp'))
def user(self):
return self.__getElement('user')
def uid(self):
Expand Down
5 changes: 3 additions & 2 deletions OSMPythonTools/overpass.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from OSMPythonTools.nominatim import Nominatim, NominatimResult
import datetime as dt
import sys
import dateutil.parser
import time
import urllib.parse
import urllib.request
Expand Down Expand Up @@ -132,9 +133,9 @@ def version(self):
def generator(self):
return self.__get('generator')
def timestamp_osm_base(self):
return self.__get2('osm3s', 'timestamp_osm_base')
return dateutil.parser.isoparse(self.__get2('osm3s', 'timestamp_osm_base'))
def timestamp_area_base(self):
return self.__get2('osm3s', 'timestamp_area_base')
return dateutil.parser.isoparse(self.__get2('osm3s', 'timestamp_area_base'))
def copyright(self):
return self.__get2('osm3s', 'copyright')
def remark(self):
Expand Down
2 changes: 1 addition & 1 deletion docs/element.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ changedNodes.elements()[0].user()
changedNodes.elements()[0].userid()
# 4913117
changedNodes.elements()[0].timestamp()
'2017-01-03T13:47:23Z'
# 2017-01-03 13:47:23+00:00'
```

0 comments on commit 487381a

Please sign in to comment.