mirror of
https://github.com/kennethreitz/maya.git
synced 2026-06-05 23:00:18 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77bfce0bae |
@@ -0,0 +1,11 @@
|
||||
[packages]
|
||||
humanize = "*"
|
||||
pytz = "*"
|
||||
dateparser = "*"
|
||||
iso8601 = "*"
|
||||
python-dateutil = "*"
|
||||
"ruamel.yaml" = "*"
|
||||
tzlocal = "*"
|
||||
|
||||
[dev-packages]
|
||||
pytest = "*"
|
||||
@@ -139,6 +139,11 @@ class MayaDT(object):
|
||||
"""Returns MayaDT instance from rfc2822 string."""
|
||||
return parse(string)
|
||||
|
||||
@staticmethod
|
||||
def from_rfc3339(string):
|
||||
"""Returns MayaDT instance from rfc3339 string."""
|
||||
return parse(string)
|
||||
|
||||
# Exporters
|
||||
# ---------
|
||||
|
||||
@@ -175,6 +180,10 @@ class MayaDT(object):
|
||||
"""Returns an RFC 2822 representation of the MayaDT."""
|
||||
return email.utils.formatdate(self.epoch, usegmt=True)
|
||||
|
||||
def rfc3339(self):
|
||||
"""Returns an RFC 3339 representation of the MayaDT."""
|
||||
return self.datetime().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-4]+"Z"
|
||||
|
||||
# Properties
|
||||
# ----------
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
-e .
|
||||
dateparser==0.5.0
|
||||
humanize==0.5.1
|
||||
iso8601==0.1.11
|
||||
jdatetime==1.8.1
|
||||
py==1.4.32
|
||||
pytest==3.0.5
|
||||
python-dateutil==2.6.0
|
||||
pytz==2016.10
|
||||
regex==2016.11.21
|
||||
#ruamel.ordereddict is only needed for python 2
|
||||
#ruamel.ordereddict==0.4.9
|
||||
ruamel.yaml==0.13.4
|
||||
six==1.10.0
|
||||
typing==3.5.2.2
|
||||
tzlocal==1.3
|
||||
umalqurra==0.2
|
||||
@@ -36,7 +36,7 @@ required = [
|
||||
|
||||
setup(
|
||||
name='maya',
|
||||
version='0.1.6',
|
||||
version='0.1.7',
|
||||
description='Datetimes for Humans.',
|
||||
long_description=long_description,
|
||||
author='Kenneth Reitz',
|
||||
|
||||
@@ -115,6 +115,12 @@ def test_datetime_to_timezone():
|
||||
dt = maya.when('2016-01-01').datetime(to_timezone='US/Eastern')
|
||||
assert dt.tzinfo.zone == 'US/Eastern'
|
||||
|
||||
def test_rfc3339():
|
||||
mdt = maya.when('2016-01-01')
|
||||
out = mdt.rfc3339()
|
||||
mdt2 = maya.MayaDT.from_rfc3339(out)
|
||||
assert mdt.epoch == mdt2.epoch
|
||||
|
||||
|
||||
def test_comparison_operations():
|
||||
now = maya.now()
|
||||
|
||||
Reference in New Issue
Block a user