Skip to content

Commit

Permalink
Merge pull request #150 from marcelstoer/patch-1
Browse files Browse the repository at this point in the history
Fix RFC3339 representation
  • Loading branch information
timofurrer authored May 15, 2018
2 parents 5525bed + 9ef43a2 commit 62a6283
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion maya/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def rfc2822(self):

def rfc3339(self):
"""Returns an RFC 3339 representation of the MayaDT."""
return self.datetime().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-4] + "Z"
return self.datetime().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5] + "Z"

# Properties
# ----------
Expand Down
5 changes: 5 additions & 0 deletions tests/test_maya.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ def test_rfc3339():
mdt2 = maya.MayaDT.from_rfc3339(out)
assert mdt.epoch == mdt2.epoch

rfc3339 = maya.MayaDT.rfc3339(maya.when('2016-01-01T12:03:03Z'))
# it's important that the string has got a "max 1-digit millis" fragment
# as per https://tools.ietf.org/html/rfc3339#section-5.6
assert rfc3339 == '2016-01-01T12:03:03.0Z'


@pytest.mark.usefixtures("frozen_now")
def test_comparison_operations():
Expand Down

0 comments on commit 62a6283

Please sign in to comment.