Skip to content

Commit

Permalink
Merge pull request #15 from laws-africa/iso8601
Browse files Browse the repository at this point in the history
Replace arrow with iso8601
  • Loading branch information
longhotsummer committed Jan 10, 2020
2 parents d91b626 + 34b25e6 commit bff67ad
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions README.rst
Expand Up @@ -79,6 +79,11 @@ Cobalt is Copyright 2015-2017 AfricanLII.
Change Log
----------

3.1.0
-----

- Replace arrow with iso8601, avoiding [arrow issue 612](https://github.com/crsmithdev/arrow/issues/612)

3.0.0
.....

Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.0.0
3.1.0
14 changes: 7 additions & 7 deletions cobalt/act.py
Expand Up @@ -3,7 +3,7 @@

from lxml import objectify
from lxml import etree
import arrow
from iso8601 import parse_date

from .uri import FrbrUri

Expand Down Expand Up @@ -90,7 +90,7 @@ def title(self, value):
@property
def work_date(self):
""" Date from the FRBRWork element """
return arrow.get(self.meta.identification.FRBRWork.FRBRdate.get('date')).date()
return parse_date(self.meta.identification.FRBRWork.FRBRdate.get('date')).date()

@work_date.setter
def work_date(self, value):
Expand All @@ -99,7 +99,7 @@ def work_date(self, value):
@property
def expression_date(self):
""" Date from the FRBRExpression element """
return arrow.get(self.meta.identification.FRBRExpression.FRBRdate.get('date')).date()
return parse_date(self.meta.identification.FRBRExpression.FRBRdate.get('date')).date()

@expression_date.setter
def expression_date(self, value):
Expand All @@ -110,7 +110,7 @@ def expression_date(self, value):
@property
def manifestation_date(self):
""" Date from the FRBRManifestation element """
return arrow.get(self.meta.identification.FRBRManifestation.FRBRdate.get('date')).date()
return parse_date(self.meta.identification.FRBRManifestation.FRBRdate.get('date')).date()

@manifestation_date.setter
def manifestation_date(self, value):
Expand All @@ -134,7 +134,7 @@ def publication_date(self):
""" Date of the publication """
pub = self._get('meta.publication')
if pub is not None and pub.get('date'):
return arrow.get(pub.get('date')).date()
return parse_date(pub.get('date')).date()
return None

@publication_date.setter
Expand Down Expand Up @@ -240,7 +240,7 @@ def amendments(self):
amendments = []

for e in self.meta.iterfind('.//{*}lifecycle/{*}eventRef[@type="amendment"]'):
date = arrow.get(e.get('date')).date()
date = parse_date(e.get('date')).date()
event = AmendmentEvent(date=date)
amendments.append(event)

Expand Down Expand Up @@ -296,7 +296,7 @@ def amendments(self, value):
def repeal(self):
e = self.meta.find('.//{*}lifecycle/{*}eventRef[@type="repeal"]')
if e is not None:
date = arrow.get(e.get('date')).date()
date = parse_date(e.get('date')).date()
event = RepealEvent(date=date)

id = e.get('source')[1:]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -65,7 +65,7 @@
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
'arrow >= 0.5.0',
'iso8601 >= 0.1',
'lxml >= 3.4.1',
],

Expand Down

0 comments on commit bff67ad

Please sign in to comment.